mariangela mone
/
BLUETOOTH
bluetooth
Diff: main.cpp
- Revision:
- 0:1cd78549370a
- Child:
- 1:d33dca22f3a1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 06 14:39:40 2017 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" +#include "SoftSerial.h" + +PwmOut mypwm(D5); +Serial pc(USBTX,USBRX); +DigitalOut myled(LED1); +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); + } + mypwm.write(vel); + } +}