fork 1

Dependencies:   mbed

Fork of eic_blinky_interrupt by 尚人 永井

Revision:
0:866573259a54
Child:
1:47e9b18377b9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 14 12:51:33 2014 +0000
@@ -0,0 +1,26 @@
+#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();
+    }
+}
+
+void pc_rx ()
+{
+    char buff=pc.getc();
+    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);
+    }
+        
+}