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
Diff: main.cpp
- Revision:
- 0:4dafd42a62ef
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Sep 04 04:52:33 2020 +0000
@@ -0,0 +1,35 @@
+#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;
+ }
+
+ }
+}