WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation


Supports voltage measurement.
All reading from this library are in 'volts' regardless of whether it is AC or DC. AC voltages are positive whereas DC voltages positive or negative.
These devices use one ADC pin for each reading but you will need to check the individual data sheets to see what power supply they need.
Since all of the devices have been implemented in the same way then it means that you can swap one device for another by only changing the #include and the MAKE command used to create the device.
So here is the generic way to work with a <DEVICE> of a given <MAKE> and <MODEL>:-
// Include the relevant sensor file
#include "Sensors/Voltage/<MAKE>/<MODEL>.h"
// Create the device
<DEVICE> myVoltage = MAKE_<DEVICE>(ADC pin);
In your appInitHardware you should initialise the device:-
Then in your main loop you can read the sensor using:-
The value can then be read independently into a variable of type 'VOLTAGE_TYPE':-
VOLTAGE_TYPE volts = myVoltage.voltage.volts;
Or dumped to the current rprintf destination using:-




Valid XHTML 1.0 Transitional