控制一下下

Fork of RawSerial_ex_2 by mbed_example

Files at this revision

API Documentation at this revision

Comitter:
WFKnight
Date:
Fri Jun 22 07:24:23 2018 +0000
Parent:
2:4ab47f33a1ae
Commit message:
????

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jan 10 14:24:47 2018 +0000
+++ b/main.cpp	Fri Jun 22 07:24:23 2018 +0000
@@ -4,18 +4,21 @@
 DigitalOut led2(LED2);
 
 Serial pc(USBTX, USBRX);
-
+int data_temp = 0;
 void callback_ex() {
-    // Note: you need to actually read from the serial to clear the RX interrupt
-    pc.putc(pc.getc());
-    led2 = !led2;
+    pc.scanf("%d", &data_temp);
 }
-
 int main() {
     pc.attach(&callback_ex);
-    
+    pc.printf("start\n");
     while (1) {
-        led1 = !led1;
+        if(data_temp == 0x16){//22
+            led1 = !led1;
+        }
+        else{
+            led1 = 1;
+            pc.printf("working\n");
+        }
         wait(0.5);
     }
 }