Repository navigation
6. API: Sensor Function
waiweng83 edited this page Aug 11, 2015
·
15 revisions
These are the functions to communicate with the sensors.
Turn on/off the sensor LED.
Function Prototype:
EM_ERROR eSensorSetLed( unsigned char ucId,
EM_MODEL eModuleType,
unsigned char ucLedValue );
Parameters:
- ucId - Sensor ID.
- eModuleType - Sensor type.
-
ucLedValue - Sensor LED value.
~ 0 - Off
~ 1 - On
~ 2 - Trigger
Return:
Example:
// Turn on the IR sensor LED.
eSensorSetLed(200, EM_MODEL_IR, 1);
Turn on/off and set the colour of the Head LED.
Function Prototype:
EM_ERROR eHeadSetLed( unsigned char ucId,
unsigned char ucRgb,
unsigned char ucLeftRight );
Parameters:
- ucId - Sensor ID.
- ucRgb - RGB value for the LED (RRRGGGBB).
-
ucLeftRight - Turn on/off left and right LED individually.
~ Bit 0 - Right
~ Bit 1 - Left
Return:
Example:
// Set the colour of head LED to red.
eHeadSetLed(100, 0b11100000, 0b11);
Set the red colour LED of the head module.
Function Prototype:
EM_ERROR eHeadSetRed(unsigned char ucId, unsigned char ucRedValue);
Parameters:
- ucId - Sensor ID.
- ucRedValue - Red LED value (3 bits).
Return:
Example:
// Set the colour of head LED to red.
eHeadSetRed(100, 0b111);
Set the green colour LED of the head module.
Function Prototype:
EM_ERROR eHeadSetGreen(unsigned char ucId, unsigned char ucGreenValue);
Parameters:
- ucId - Sensor ID.
- ucGreenValue - Green LED value (3 bits).
Return:
Example:
// Set the colour of head LED to green.
eHeadSetGreen(100, 0b111);
Set the blue colour LED of the head module.
Function Prototype:
EM_ERROR eHeadSetBlue(unsigned char ucId, unsigned char ucBlueValue);
Parameters:
- ucId - Sensor ID.
- ucBlueValue - Blue LED value (2 bits).
Return:
Example:
// Set the colour of head LED to blue.
eHeadSetBlue(100, 0b11);