Skip to content

6. API: Sensor Function

waiweng83 edited this page Aug 11, 2015 · 15 revisions

These are the functions to communicate with the sensors.

Function: eSensorSetLed

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);

Function: eHeadSetLed

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);

Clone this wiki locally