upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions

API for the TA12-200 Current Transformer. More...

Detailed Description

UPM module for the TA12-200 current transformer found, for instance, in the Grove Electricity Sensor. This module can measure AC moving through a wire at up to 5 A.

// Instantiate a TA12-200 sensor on analog pin A0
upm::TA12200 electricity(0);
while (shouldRun) {
unsigned int maxVal = electricity.highestValue();
float current = electricity.milliAmps(maxVal);
cout << "Max ADC Value: " << maxVal << ", current: " << current << "mA" << endl;

Public Member Functions

 TA12200 (int pin)
 ~TA12200 ()
uint32_t getMillis ()
void initClock ()
int highestValue ()
float milliAmps (unsigned int val, int res=TA12200_ADC_RES)

Constructor & Destructor Documentation

TA12200 ( int  pin)

TA12200 constructor

pinAnalog pin to use
~TA12200 ( )

TA12200 destructor

Member Function Documentation

uint32_t getMillis ( )

Returns the number of milliseconds elapsed since initClock() was last called.

Elapsed milliseconds
void initClock ( )

Resets the clock

int highestValue ( )

Gets the conversion value from the sensor

Highest value obtained over 1 second of measuring or -1 if error
float milliAmps ( unsigned int  val,
int  res = TA12200_ADC_RES 

Computes the measured voltage

valValue measured by highestValue()
resADC resolution
Measured current in mA

The documentation for this class was generated from the following files: