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.
Diff: Communicator.cpp
- Revision:
- 0:c2b3b055cc8e
- Child:
- 1:f8372f3df8d2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Communicator.cpp Tue Mar 09 20:10:45 2021 +0000 @@ -0,0 +1,78 @@ +#include "mbed.h" +Serial pc(USBTX,USBRX); +float Pedal,Thorttle,Speed,Voltage =0; // This variables give DATA +int RPM = 0; +/* Pedal 0 -255 + Thorttle 0-255 + Speed 0-90 + RPM 0-10000 + Voltage 0-24 */ + +int PedalError,ThorttleError,CANError,BSPDError,Shutdowncircuit,Brake =0; // This variables give 0 or 1 +int main(){ + int i,j,k,z = 0; + int e = 0; + pc.baud(115200); + + +while(1){ + pc.printf("P%.4f\r\n", Pedal); + pc.printf("T%.4f\r\n", Thorttle); + pc.printf("b%d\r\n", Brake); + pc.printf("R%d\r\n", RPM); + pc.printf("V%.4f\r\n", Voltage); + pc.printf("S%.4f\r\n", Speed); + pc.printf("C%d\r\n", CANError); + pc.printf("t%d\r\n", ThorttleError); + pc.printf("p%d\r\n", PedalError); + pc.printf("B%d\r\n", BSPDError); + pc.printf("s%d\r\n", Shutdowncircuit); + i++; + j++; + k++; + z++; + e++; + Pedal = i; + Thorttle = i; + RPM = j; + Speed = k; + Voltage = z; + if(i == 255){ + i =0; + } + if(j == 10000){ + j =0; + } + if (k == 90){ + k=0; + } + if (z==24){ + z=0; + } + if (e == 1000){ + e = 0; + if (Brake == 0){ + PedalError= 1; + ThorttleError= 1; + CANError= 1; + Brake= 1; + BSPDError= 1; + Shutdowncircuit = 1; + + } + else{ + PedalError= 0; + ThorttleError= 0; + CANError= 0; + Brake= 0; + BSPDError= 0; + Shutdowncircuit = 0; + } + + } + + + + + } +} \ No newline at end of file