Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Liditek_Xbee_Esclavo by
main.cpp
- Committer:
- Sumobot
- Date:
- 2017-03-03
- Revision:
- 0:7c8a05b383cd
File content as of revision 0:7c8a05b383cd:
#include "mbed.h" Serial Pc(USBTX, USBRX); Serial xbee(p9, p10); DigitalOut myled(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); DigitalOut myled4(LED4); char Str[100],Id[100],Destino[100],dis[100],sub[100];//Var-Buffer(HH:MM:SS,string ,Presion,Modo,Hora,Minuto,Segundo,Ciclos //&&&&&&&&&&&&&&&&&&&&&&&&&&&&Variables Presion temperatura&&&&&&&&&&&&&&&&&&&&&&&& int dis_S, sub_S; int main() { while(1) { xbee.scanf("%s",Str); // Esperando Informacion de la pantalla Pc.printf("%s\n\r",Str); // Impresion de informacion Mandada Pc.printf("Recibido\n\r"); // Mensaje de estado strcpy(Id, strtok(Str , ".")); strcpy(Destino, strtok(NULL , ",")); strcpy(dis, strtok(NULL, ":")); strcpy(sub, strtok(NULL, "\n")); dis_S = atof(dis);sub_S = atof(sub); if(Id == "E") { myled3 = 1; wait(1); } if(dis_S==1) { myled = 1; wait(1); } if(dis_S==0) { myled = 0; wait(1); } if(sub_S==1) { myled2 = 1; wait(1); } if(sub_S==0) { myled2 = 0; wait(1); } } }