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.
Diff: main.cpp
- Revision:
- 0:ed82bc2dec29
- Child:
- 1:0fec28dd7cd1
diff -r 000000000000 -r ed82bc2dec29 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jun 22 16:50:14 2016 +0000
@@ -0,0 +1,88 @@
+#include "mbed.h"
+
+Serial device(PC_10,PC_11); // Puerto serial para comunicar con modulo WIFI
+Serial pc(USBTX,USBRX); // Puerto serial para comunicar con la pc
+
+int rxCount = 0;
+int rcvFlag = 0;
+char rxbuff[64];
+
+DigitalOut led(LED1);
+
+void sISR()
+{
+ //while (device.readable())
+ //{
+ rxbuff[rxCount] = device.getc(); // dato recibido se almacena en rxbuff
+ rxCount++;
+ //}
+
+ if(rxCount >=6)
+ {
+
+ if((rxbuff[0]== 0x53)&&(rxbuff[1]==0x54))
+ {
+ rcvFlag = 1;
+ }
+ else
+ {
+ memset(rxbuff, '\0', sizeof(rxbuff));
+ rxCount = 0;
+ }
+ }
+}
+
+int main() {
+
+ device.baud(9600); // configuramos ambos puertos a 115200 bps
+ pc.baud(115200);
+
+ device.attach(&sISR); // habilita recepcion por interrupcion serial
+
+ while(1)
+
+ {
+
+ if(rcvFlag ==1)
+ {
+ led = !led;
+ device.attach(NULL);
+
+ switch(rxbuff[2])
+ {
+ case 1: // leds
+ {
+
+ }
+ break;
+
+ case 2:
+ {
+
+ }
+ break;
+
+
+ case 3: //slider
+ {
+
+
+ }
+ break;
+
+
+ default:break;
+ }
+
+
+
+
+ memset(rxbuff, '\0', sizeof(rxbuff));
+ rxCount = 0;
+ rcvFlag = 0;
+ device.attach(&sISR); // habilita recepcion por interrupcion serial
+
+ }
+
+ }
+}