You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a Battery Class that reads the voltage of the battery and can tell when the battery crosses below a given threshold (BATTERY_VOLTAGE_MIN). It should have a function that returns true if the battery voltage is below the threshold, false otherwise. Because the voltage read by the pin might not be accurate, we need to wait until we have multiple readings, and only return true if:
A minimum number of readings have been recorded.
Those readings are all similar to each other.
The average of those readings is below a given threshold.
Therefore, the class should store a number of readings in a queue (BATTERY_N_READINGS), and return false if the queue isn't full. It could then first calculate the average value of the readings, and return false if any one reading differs from the average by more than (BATTERY_MAX_DISCREPANCY).
Create a Battery Class that reads the voltage of the battery and can tell when the battery crosses below a given threshold (BATTERY_VOLTAGE_MIN). It should have a function that returns true if the battery voltage is below the threshold, false otherwise. Because the voltage read by the pin might not be accurate, we need to wait until we have multiple readings, and only return true if:
Therefore, the class should store a number of readings in a queue (BATTERY_N_READINGS), and return false if the queue isn't full. It could then first calculate the average value of the readings, and return false if any one reading differs from the average by more than (BATTERY_MAX_DISCREPANCY).
Needed Arduino functions:
pinMode()
analogRead()
The text was updated successfully, but these errors were encountered: