Lcd display

Dependencies:   mbed SerialLCD

Communicator.cpp

Committer:
noamnahum
Date:
2021-03-09
Revision:
0:c2b3b055cc8e
Child:
1:f8372f3df8d2

File content as of revision 0:c2b3b055cc8e:

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

        
    }        
}