
scanf test.
main.cpp
- Committer:
- ogata_lab
- Date:
- 2013-06-06
- Revision:
- 0:30bfe67b0254
File content as of revision 0:30bfe67b0254:
#include "mbed.h" #include "Serial.h" Serial usbSerial(USBTX, USBRX); PwmOut leds[4] = {LED1, LED2, LED3, LED4}; int main() { float n = 0; while(1) { usbSerial.printf("Input Command:"); usbSerial.scanf("%f", &n); if (n > 1.0) n = 1.0; else if(n < 0.0) n = 0.0; for(int i = 0;i < 4;i++) { leds[i].write(n); } usbSerial.printf("OK.¥n"); wait(0.5); } }