Battery_hex
Dependencies: mbed PowerControl SDFileSystem
Fork of HeptaBattery_hex by
Diff: main.cpp
- Revision:
- 1:4e0d741b4ae2
- Parent:
- 0:30e193b92735
--- a/main.cpp Fri Dec 09 04:19:51 2016 +0000 +++ b/main.cpp Tue Dec 13 06:55:26 2016 +0000 @@ -1,19 +1,19 @@ #include"mbed.h" #include"HeptaBattery.h" + Serial pc(USBTX,USBRX); HeptaBattery battery(p16,p29,p26); + int main(){ - pc.baud(9600); - int dsize; - float bt_dec; - char bt_hex[4]; - for(int i=0;i<10;i++){ - battery.vol(&bt_dec); - pc.printf("Vol=%f\r\n",bt_dec); - } - for(int j=0;j<10;j++){ - battery.vol_u16(bt_hex,&dsize); - pc.printf("Vol_hex=%c%c%c%c\r\n",bt_hex[0],bt_hex[1],bt_hex[2],bt_hex[3]); - } - wait(1.0); + pc.baud(9600); + int dsize; + float bt_dec; + char bt_hex[4]; + for(int i=0;i<10;i++){ + battery.vol(&bt_dec); + battery.vol_u16(bt_hex,&dsize); + pc.printf("Vol=%f\r\n",bt_dec); + pc.printf("Vol_hex=%c%c%c%c\r\n",bt_hex[0],bt_hex[1],bt_hex[2],bt_hex[3]); + wait(1.0); + } } \ No newline at end of file