measure supply voltage with analogRead and use that to convert voltage to value needed to set driver at to get that voltage
More...
#include <JVoltageCompMeasure.h>
|
| JVoltageCompMeasure (byte _measurePin, float _DACUnitsPerVolt, unsigned int _measurementIntervalMillis=10) |
| constructor
|
|
float | adjust (float voltage, float driverRange) |
| do conversion
|
|
float | getSupplyVoltage () |
|
template<byte N>
class JVoltageCompMeasure< N >
measure supply voltage with analogRead and use that to convert voltage to value needed to set driver at to get that voltage
- Note
- N (the value in the template) is how many measurements to average together to smooth voltage readings
◆ JVoltageCompMeasure()
constructor
- Parameters
-
_measurePin | pin to use to measure battery voltage (you probably want to make a voltage divider with a couple resistors) |
_DACUnitsPerVolt | the value read through analogRead is divided by this value to get voltage |
_measurementIntervalMillis | wait this many milliseconds before taking another reading (default: 10) |
◆ adjust()
do conversion
- Parameters
-
voltage | (float) voltage wanted from motor driver output |
driverRange | (float) set what value makes the driver output 100% of supply voltage |
- Return values
-
(float) | value to set driver at |
Reimplemented from JVoltageCompensator.
◆ getSupplyVoltage()
The documentation for this class was generated from the following file: