serial for coragem

Files at this revision

API Documentation at this revision

Comitter:
brunnobbco
Date:
Thu Mar 26 13:01:56 2020 +0000
Commit message:
atualizacao serial test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed_coragem.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r d32c60c1d9b5 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 26 13:01:56 2020 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+
+DigitalOut led1(P1_13);
+DigitalOut led2(P1_14);
+//DigitalOut led3(LED3);
+//DigitalOut led4(LED4);
+
+int main(){
+    led1 = 1;
+    led2 = 1;
+//    led3 = 1;
+//    led4 = 1;
+    pc.printf("BBCO\n");
+    
+    while(true){
+        if (pc.readable()) {
+            char command = pc.getc();
+            
+            switch (command) {
+                case 'A':
+                    led1 = 0;
+                    break;
+                case 'B':
+                    led2 = 0;
+                    break;
+//                case 'C':
+//                    led3 = 0;
+//                    break;
+//                case 'D':
+//                    led4 = 0;
+//                    break;
+                case 'a':
+                    led1 = 1;
+                    break;
+                case 'b':
+                    led2 = 1;
+                    break;
+//                case 'c':
+//                    led3 = 1;
+//                    break;
+//                case 'd':
+//                    led4 = 1;
+//                    break;
+            }
+        }
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r d32c60c1d9b5 mbed_coragem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_coragem.lib	Thu Mar 26 13:01:56 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/leiachewbacca/mbed_coragem.git/#b8dad0652c9cd2321126a590280a18a964e1eed0