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.
Dependencies: mbed
Diff: main.cpp
- Revision:
 - 0:4c9e631d23ca
 
--- /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;
+            }
+        }
+    }
+}