Tatsuki Fukuda
/
eic_blinky_interrupt
fork 1
Fork of eic_blinky_interrupt by
main.cpp
- Committer:
- Naoto_111
- Date:
- 2014-05-20
- Revision:
- 3:50d8d4dc9ad6
- Parent:
- 2:ab5ef3f84cd5
- Child:
- 4:2b12ce3ec6b0
File content as of revision 3:50d8d4dc9ad6:
#include "mbed.h" Serial pc(USBTX,USBRX);//tx,rx AnalogOut led_y(p18); void pc_rx(); int main() { pc.attach(&pc_rx,Serial::RxIrq); while(1) { sleep(); //pc.printf("wakeup\r\n"); } } void pc_rx () { char buff=pc.getc(); pc.putc(buff); if('A'<=buff&&buff<='Z') { pc.putc(buff+0x20); } else if('a'<=buff&&buff<='z') { pc.putc(buff-0x20); } else if('0'<=buff&&buff<='9') { float a=(buff-'0'+1)*0.1;//buff=='0'->a=0.1 buff=='9'->a=1.0 led_y=a; pc.printf("led_y=%f\r\n",a); } }