Skip to content

Commit 99c79af

Browse files
Update RoboHeartBLECarControl.ino
Battery voltage removed
1 parent c863bd1 commit 99c79af

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

examples/RoboHeartBLECarControl/RoboHeartBLECarControl.ino

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,6 @@ void bleConnected() {
100100
heart.motorC.sleep(false);
101101
}
102102

103-
int battery_percent(){
104-
float raw_value = analogRead(BATTERY_PIN);
105-
float voltage_level = ((raw_value * 3.3)/ MAX_ANALOG_VAL )* 2 ; // multiply the analogRead value by 2x to get the true battery
106-
//Serial.println(voltage_level);
107-
float battery_fraction = voltage_level / MAX_BATTERY_VOLTAGE;
108-
float voltage_range = voltage_level - MIN_BATTERY_VOLTAGE;
109-
int percent = (voltage_range / BATTERY_RANGE) * 100;
110-
return percent;
111-
}
112-
113-
114103
void setup() {
115104
Serial.begin(115200);
116105

@@ -136,12 +125,10 @@ void setup() {
136125

137126
void loop() {
138127

139-
int percent = battery_percent();
140128
// Send some information to the ble
141129
if (bleDeviceConnected) {
142130
blePackage[0]++;
143131
ble.sendNotifyChar2(blePackage);
144-
ble.sendNotifyChar3((uint8_t *)(&percent));
145132
delay(3); // bluetooth stack will go into congestion, if too many packets
146133
// are sent, in 6 hours test we were able to go as low as 3ms
147134
}

0 commit comments

Comments
 (0)