bluetooth

Dependencies:   SoftSerial mbed

main.cpp

Committer:
YARodriguez
Date:
2017-10-06
Revision:
0:1cd78549370a
Child:
1:d33dca22f3a1

File content as of revision 0:1cd78549370a:

#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);
    }
}