#include <arpirobot/arduino/sensor/VoltageMonitor.hpp>
|
| VoltageMonitor (std::string pin, double vboard, int r1, int r2, bool createDevice=true, int deviceId=-1) |
|
| VoltageMonitor (int pin, double vboard, int r1, int r2, bool createDevice=true, int deviceId=-1) |
|
double | getVoltage () |
|
| ArduinoDevice (bool createDevice, int deviceId) |
|
virtual std::string | getDeviceName () |
|
Public Member Functions inherited from arpirobot::MainVmon |
void | makeMainVmon () |
|
|
void | applyDefaultState () override |
|
std::vector< uint8_t > | getCreateData () override |
|
void | handleData (const std::vector< uint8_t > &data) override |
|
void | setArduino (BaseArduinoInterface *arduino) |
|
void | setDeviceId (int deviceId) |
|
bool | sendData (const std::vector< uint8_t > &data) |
|
bool | sendData (const std::string &data) |
|
Protected Member Functions inherited from arpirobot::MainVmon |
bool | isMainVmon () |
|
void | sendMainBatteryVoltage (double voltage) |
|
|
static std::vector< uint8_t > | stringToData (const std::string &str) |
|
bool | createDevice |
|
int | deviceId |
|
std::string | deviceName |
|
BaseArduinoInterface * | arduino = nullptr |
|
Simple analog input voltage monitor (using voltage divider) connected to arduino analog input.
◆ VoltageMonitor() [1/2]
arpirobot::VoltageMonitor::VoltageMonitor |
( |
std::string |
pin, |
|
|
double |
vboard, |
|
|
int |
r1, |
|
|
int |
r2, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
pin | The analog input pin this voltage monitor is connected to (can be prefixed with letter A) |
vboard | The board voltage for this arduino (usually 5V or 3.3V). |
r1 | The top resistor of the voltage divider |
r2 | The bottom resistor of the voltage divider (the one voltage is measured across) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ VoltageMonitor() [2/2]
arpirobot::VoltageMonitor::VoltageMonitor |
( |
int |
pin, |
|
|
double |
vboard, |
|
|
int |
r1, |
|
|
int |
r2, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
pin | The analog input pin number this voltage monitor is connected |
vboard | The board voltage for this arduino (usually 5V or 3.3V). |
r1 | The top resistor of the voltage divider |
r2 | The bottom resistor of the voltage divider (the one voltage is measured across) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ getVoltage()
double arpirobot::VoltageMonitor::getVoltage |
( |
| ) |
|
Get the voltage read by this voltage monitor (in volts)
- Returns
- The voltage in volts
The documentation for this class was generated from the following file: