Hybrid_OB2021 / Mbed 2 deprecated Hybrid_OB2021_ex_MultiPlexer

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Sigma884
Date:
Sat May 22 16:59:13 2021 +0000
Commit message:
first commit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat May 22 16:59:13 2021 +0000
@@ -0,0 +1,65 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX, 115200);
+
+DigitalOut pinA(p21);
+DigitalOut pinB(p22);
+DigitalOut pinC(p23);
+
+int main() {
+    while(1) {
+        if(pc.readable()){
+            char c = pc.getc();
+            pc.printf("Input: %c\r\n", c);
+            switch(c){
+                case '0':
+                pinA = 0;
+                pinB = 0;
+                pinC = 0;
+                break;
+                
+                case '1':
+                pinA = 1;
+                pinB = 0;
+                pinC = 0;
+                break;
+                
+                case '2':
+                pinA = 0;
+                pinB = 1;
+                pinC = 0;
+                break;
+                
+                case '3':
+                pinA = 1;
+                pinB = 1;
+                pinC = 0;
+                break;
+                
+                case '4':
+                pinA = 0;
+                pinB = 0;
+                pinC = 1;
+                break;
+                
+                case '5':
+                pinA = 1;
+                pinB = 0;
+                pinC = 1;
+                break;
+                
+                case '6':
+                pinA = 0;
+                pinB = 1;
+                pinC = 1;
+                break;
+                
+                case '7':
+                pinA = 1;
+                pinB = 1;
+                pinC = 1;
+                break;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat May 22 16:59:13 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file