Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- mariangelamone
- Date:
- 2018-11-16
- Revision:
- 1:d33dca22f3a1
- Parent:
- 0:1cd78549370a
- Child:
- 2:9c890a4ddf0e
File content as of revision 1:d33dca22f3a1:
#include "mbed.h"
#include "SoftSerial.h"
PwmOut mypwm(D6);
PwmOut mypwm1(D5);
PwmOut mypwm2(D9);
PwmOut mypwm3(D10);
Serial pc(USBTX,USBRX);
DigitalOut myled(LED1);
DigitalOut aa(D5);
DigitalOut ab(D6);
DigitalOut ba(D9);
DigitalOut bb(D10);
SoftSerial bt(D2,D3); //TX RX
char receive;
float vel;
int main()
{
while(1)
{
if (bt.readable()>0)
{
receive=bt.getc();
//invio=bt.putc();
//if(receive=='1')myled=!myled; //toggle
vel=receive-48;
vel/=10;
pc.printf("%c %f\n\r", receive, vel);
if(receive=='1'){
bt.printf("ciao");
aa=0;
ab=1;
ba=0;
bb=1;
}
if(receive=='2'){
aa=1;
ab=0;
ba=1;
bb=0;
}
if(receive=='0'){
aa=0;
ab=0;
ba=0;
bb=0;
}
if(receive=='3'){
aa=0;
ab=0;
ba=0;
bb=1;
}
if(receive=='4'){
aa=0;
ab=0;
ba=1;
bb=0;
}
if(receive=='5'){
aa=0;
ab=1;
ba=0;
bb=0;
}
if(receive=='6'){
aa=1;
ab=0;
ba=0;
bb=0;
}
}
mypwm.write(LED1);
}
}