
Console Example
main.cpp
- Committer:
- ogata_lab
- Date:
- 2013-06-06
- Revision:
- 0:f7ffea7d552c
File content as of revision 0:f7ffea7d552c:
#include "mbed.h" #include "Serial.h" Serial usbSerial(USBTX, USBRX); DigitalOut leds[4] = {LED1, LED2, LED3, LED4}; int main() { usbSerial.printf("Hello World!"); while(1) { char c = usbSerial.getc(); switch(c) { case '1': leds[0] = 1; break; case '2': leds[1] = 1; break; case '3': leds[2] = 1; break; case '4': leds[3] = 1; break; default: leds[0] = 0; leds[1] = 0; leds[2] = 0; leds[3] = 0; break; } } }