control de servo con bt

Dependencies:   Servo SoftSerial mbed

Revision:
0:2acb15ba6059
Child:
1:998b1ef95a89
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 07 21:56:14 2017 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "SoftSerial.h"
+//#include "Servo.h"
+
+PwmOut servo(PB_5);
+Serial pc (USBTX,USBRX);
+SoftSerial bt (D2,D3);
+
+char receive;
+float vel;
+
+int main() 
+{
+    
+
+    while (1)
+    {
+        if (bt.readable()>0)
+        {
+          
+           receive=bt.getc();
+           vel=receive-48;
+           vel/=10;
+           pc.printf("%c  %f\n\r",receive,vel);
+          servo.write(vel);
+          
+          
+                   
+        }        
+    }
+       
+}
+    
\ No newline at end of file