Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Functions | Variables

Energy Meter


file  lego-energymeter.h

RobotC Energy Meter Driver.


#define LEGOEM_I2C_ADDR   0x04
#define LEGOEM_I2C_REG   0x0A
#define LEGOEM_I2C_SIZE   14


bool LEGOEMreadData (tSensors link, float &voltageIn, float &currentIn, float &voltageOut, float &currentOut, int &joule, float &wattIn, float &wattOut)


tByteArray LEGOEM_I2CRequest
tByteArray LEGOEM_I2CReply

Detailed Description

Energy Meter

Define Documentation

#define LEGOEM_I2C_ADDR   0x04

Energy Meter I2C device address

Definition at line 47 of file lego-energymeter.h.

#define LEGOEM_I2C_REG   0x0A

Start of I2C registers that need to be read

Definition at line 48 of file lego-energymeter.h.

#define LEGOEM_I2C_SIZE   14

Number of registers to read at once

Definition at line 49 of file lego-energymeter.h.

Function Documentation

bool LEGOEMreadData ( tSensors  link,
float &  voltageIn,
float &  currentIn,
float &  voltageOut,
float &  currentOut,
int &  joule,
float &  wattIn,
float &  wattOut 

Read a snapshot of the current register values. They must all be read at once to ensure data coherency.

linkthe LEGO Energy Meter port number
voltageInvoltage level on input
currentIncurrent supplied on input
voltageOutvoltage on output
currentOutcurrent drawn on output
joulenumber of Joules stored on E-Meter
wattInamount of Watts coming in
wattOutamount of Watts being consumed
true if no error occured, false if it did

Definition at line 78 of file lego-energymeter.h.

Variable Documentation

Array to hold I2C reply data

Definition at line 59 of file lego-energymeter.h.

Array to hold I2C command data

Definition at line 58 of file lego-energymeter.h.