Update voltage measurement. Change ADC config setting.
Dependencies: BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1
Fork of BLE_BatteryLevel_ADC_170608 by
Revision 22:ad0c52ec5bf9, committed 2017-07-24
- Comitter:
- Jun_adi
- Date:
- Mon Jul 24 02:05:26 2017 +0000
- Parent:
- 21:245543d2eb2c
- Commit message:
- Edit the "ADC read" code.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Jul 05 06:23:28 2017 +0000
+++ b/main.cpp Mon Jul 24 02:05:26 2017 +0000
@@ -87,11 +87,13 @@
while (true) {
ble.waitForEvent(); // this will return upon any system event (such as an interrupt or a ticker wakeup)
- //Read Anlog input voltage
//batteryLevel = analogin.read()*100;
- batteryLevel = analogin.read()* 1.2 * 30; //
+
+ //Read Anlog input voltage
+ batteryLevel = analogin.read()* 1.2 * 3 * 10;
batteryService->updateBatteryLevel(batteryLevel);
}
+
/*
// the magic battery processing
batteryLevel++;
@@ -100,6 +102,6 @@
}
batteryService->updateBatteryLevel(batteryLevel);
- }
+ }
*/
}
