ChargeControl
Dependencies: mbed PowerControl SDFileSystem
Fork of ChargeControl by
Revision 1:cbbad81dc88d, committed 2016-12-13
- Comitter:
- tomoya123
- Date:
- Tue Dec 13 07:44:05 2016 +0000
- Parent:
- 0:0842f00470eb
- Commit message:
- ChargeControl
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0842f00470eb -r cbbad81dc88d main.cpp --- a/main.cpp Fri Dec 09 05:04:37 2016 +0000 +++ b/main.cpp Tue Dec 13 07:44:05 2016 +0000 @@ -1,19 +1,20 @@ #include "mbed.h" #include "HeptaBattery.h" + Serial pc(USBTX,USBRX); HeptaBattery battery(p16,p29,p26); int main(){ - pc.baud(9600); - int save_flag,bc_state; - float bt_dec; - for(int i=0;i<10;i++){ - battery.vol(&bt_dec); - if(bt_dec>=4.2) bc_state=1; - else if(bt_dec < 4.2&&bt_dec>=3.5) bc_state=2; - else if(bt_dec<3.5) bc_state=3; - battery.chargecontrol(bc_state,&save_flag); - pc.printf("Voltage=%f,save_flag=%d\r\n",bt_dec,save_flag); - wait(1.0); - } + pc.baud(9600); + int save_flag,bc_state; + float bt_dec; + for(int i=0;i<10;i++){ + battery.vol(&bt_dec); + if(bt_dec>=4.2) bc_state=1; + else if(bt_dec < 4.2&&bt_dec>=3.5) bc_state=2; + else if(bt_dec<3.5) bc_state=3; + battery.chargecontrol(bc_state,&save_flag); + pc.printf("Voltage=%f,save_flag=%d\r\n",bt_dec,save_flag); + wait(1.0); + } } \ No newline at end of file