HEPTA-Sat Training 2022
/
Lab3-03_detect_battery_voltage_hex
HeptaSat
Diff: main.cpp
- Revision:
- 26:e0f46da1ff13
- Parent:
- 25:4277e16b97c3
- Child:
- 27:e1060a85b032
--- a/main.cpp Wed Aug 21 18:14:40 2019 +0000 +++ b/main.cpp Wed Aug 21 18:29:15 2019 +0000 @@ -7,10 +7,13 @@ int main() { pc.baud(9600); - float bt; + float bt_dec; + char bt_hex[4]; for(int i = 0; i < 10; i++) { - eps.vol(&bt); - pc.printf("Vol = %f\r\n",bt); + eps.vol(&bt_dec); + eps.vol_u16(bt_hex); + 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