KIT Solar Car Project / Mbed 2 deprecated BAT_Charge_T1

Dependencies:   mbed

main.cpp

Committer:
takuma1
Date:
2020-09-04
Revision:
0:4dafd42a62ef

File content as of revision 0:4dafd42a62ef:

#include "mbed.h"

DigitalOut BAT_Discharge_GND(p21);
DigitalOut BAT_Charge(p22);
DigitalOut BAT_Normal(p23);
AnalogIn Driver_Swich(p20);


int main() {
    int count = 0;
    while(1) {
            
            if(Driver_Swich == 1){
                printf("1\n");
               BAT_Discharge_GND = 1;
                if(count == 0){
                 BAT_Charge = 1;
                   wait(3);
                   count++;
                BAT_Charge = 0;
                              }
                BAT_Normal = 1;
                                 }
                          
            if(Driver_Swich == 0){
                BAT_Normal = 0;
                BAT_Discharge_GND =0;
                BAT_Charge = 0;
                printf("2\n");
                //wait(2);
                count = 0;    
                                 }
                                 
           }
}