
scanf test1
main.cpp
- Committer:
- ogata_lab
- Date:
- 2013-06-06
- Revision:
- 0:e63ba9ce4d7d
File content as of revision 0:e63ba9ce4d7d:
#include "mbed.h" #include "Serial.h" Serial usbSerial(USBTX, USBRX); DigitalOut leds[4] = {LED1, LED2, LED3, LED4}; int main() { int n = 0; while(1) { int i; usbSerial.printf("Input Command:"); usbSerial.scanf("%d", &n); for(i = 0;i < 4 && i < n;i++) { leds[i] = 1; } for(;i < 4;i++) { leds[i] = 0; } usbSerial.printf("OK.¥m"); wait(0.5); } }