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

Current

Supports current measurement.
All reading from this library are in 'amps' regardless of whether it is AC or DC.
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/Current/<MAKE>/<MODEL>.h"
// Create the device
<DEVICE> myCurrent = MAKE_<DEVICE>(ADC pin);
In your appInitHardware you should initialise the device:-
currentInit(myCurrent);
Then in your main loop you can read the sensor using:-
currentRead(myCurrent);
The value can then be read independently into a variable of type 'CURRENT_TYPE':-
CURRENT_TYPE amps = myCurrent.current.amps;
Or dumped to the current rprintf destination using:-
currentDump(myCurrent);

 

File

 

Valid XHTML 1.0 Transitional