mBed with Arduino

Dependencies:   mbed

Fork of Serial_2 by TaChing Yu

Files at this revision

API Documentation at this revision

Comitter:
liuminhaw
Date:
Sun Sep 04 03:41:20 2016 +0000
Parent:
0:5d2615cbb0df
Commit message:
mbed with arduino

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Aug 27 11:22:23 2016 +0000
+++ b/main.cpp	Sun Sep 04 03:41:20 2016 +0000
@@ -1,20 +1,27 @@
 #include "mbed.h"
-DigitalOut led(D2);
-Serial pc(USBTX, USBRX);
+
+#define esp8266 pc
+DigitalOut led_extern(PB_15);
+DigitalOut led(LED1);
+//Serial pc(USBTX, USBRX);
+Serial esp8266(PB_6, PB_7);
 char val;
 int main() {
-    pc.baud(9600);
+    pc.baud(115200);
+    //esp8266(115200);
     while(1) {
     if(pc.readable()) {
-        pc.printf("Ready\n");
+        //pc.printf("Ready\n");
         val = pc.getc();
         if(val=='a'){
             led = 1 ;
-            pc.printf("LED ON\n");
+            led_extern = 1;
+            //pc.printf("LED ON\n");
     } 
         else if (val == 'b') {
             led = 0;
-            pc.printf("LED OFF\n");
+            led_extern = 0;
+            //pc.printf("LED OFF\n");
     }
   }
 }