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
main.cpp
- Committer:
 - Sigma884
 - Date:
 - 2021-05-22
 - Revision:
 - 0:4c9e631d23ca
 
File content as of revision 0:4c9e631d23ca:
#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;
            }
        }
    }
}