Definitions of API for controlling sensors. More...
Data Structures | |
struct | rgb_raw_t |
Structure for an RGB raw value. More... | |
struct | ir_seek_t |
Structure for IR Seek values for all 4 channels. More... | |
struct | ir_remote_t |
Macros | |
#define | IR_RED_UP_BUTTON 1 |
#define | IR_RED_DOWN_BUTTON 2 |
#define | IR_BLUE_UP_BUTTON 4 |
#define | IR_BLUE_DOWN_BUTTON 8 |
#define | IR_BEACON_BUTTON 16 |
Enumerations | |
enum | sensor_port_t { EV3_PORT_1 = 0, EV3_PORT_2 = 1, EV3_PORT_3 = 2, EV3_PORT_4 = 3, TNUM_SENSOR_PORT = 4 } |
Enumeration type for supported sensor ports. More... | |
enum | sensor_type_t { NONE_SENSOR = 0, ULTRASONIC_SENSOR, GYRO_SENSOR, TOUCH_SENSOR, COLOR_SENSOR, INFRARED_SENSOR, HT_NXT_ACCEL_SENSOR, NXT_TEMP_SENSOR, TNUM_SENSOR_TYPE } |
Enumeration type for supported sensor types. More... | |
enum | colorid_t { COLOR_NONE = 0, COLOR_BLACK = 1, COLOR_BLUE = 2, COLOR_GREEN = 3, COLOR_YELLOW = 4, COLOR_RED = 5, COLOR_WHITE = 6, COLOR_BROWN = 7, TNUM_COLOR } |
Enumeration type for colors that can be detected by color sensor. More... | |
Functions | |
ER | ev3_sensor_config (sensor_port_t port, sensor_type_t type) |
Configure a sensor port. More... | |
ER_UINT | ev3_sensor_get_type (sensor_port_t port) |
Get the type of a sensor port. More... | |
colorid_t | ev3_color_sensor_get_color (sensor_port_t port) |
Get the color by a color sensor. More... | |
uint8_t | ev3_color_sensor_get_reflect (sensor_port_t port) |
Get the reflect light intensity by a color sensor. More... | |
uint8_t | ev3_color_sensor_get_ambient (sensor_port_t port) |
Get the ambient light intensity by a color sensor. More... | |
void | ev3_color_sensor_get_rgb_raw (sensor_port_t port, rgb_raw_t *val) |
Get the RGB raw value by a color sensor. More... | |
int16_t | ev3_gyro_sensor_get_angle (sensor_port_t port) |
Get the angular position by a gyroscope sensor. More... | |
int16_t | ev3_gyro_sensor_get_rate (sensor_port_t port) |
Get the angular speed by a gyroscope sensor. More... | |
ER | ev3_gyro_sensor_reset (sensor_port_t port) |
Reset the angular position of a gyroscope sensor to zero. More... | |
int16_t | ev3_ultrasonic_sensor_get_distance (sensor_port_t port) |
Get the distance by a ultrasonic sensor. More... | |
bool_t | ev3_ultrasonic_sensor_listen (sensor_port_t port) |
Get a ultrasonic signal by a ultrasonic sensor. More... | |
int8_t | ev3_infrared_sensor_get_distance (sensor_port_t port) |
Get the distance using the infrared sensor. More... | |
ir_seek_t | ev3_infrared_sensor_seek (sensor_port_t port) |
Gets values to seek a remote controller in beacon mode. More... | |
ir_remote_t | ev3_infrared_sensor_get_remote (sensor_port_t port) |
Gets commands from IR remote controllers. More... | |
bool_t | ev3_touch_sensor_is_pressed (sensor_port_t port) |
Get the status of a touch sensor. More... | |
bool_t | ht_nxt_accel_sensor_measure (sensor_port_t port, int16_t axes[3]) |
Measure acceleration with a HiTechnic NXT acceleration sensor. More... | |
bool_t | nxt_temp_sensor_measure (sensor_port_t port, float *temp) |
Measure temperature with a NXT temperature sensor (9749). More... | |
Definitions of API for controlling sensors.
enum colorid_t |
enum sensor_port_t |
enum sensor_type_t |
Enumeration type for supported sensor types.
uint8_t ev3_color_sensor_get_ambient | ( | sensor_port_t | port | ) |
Get the ambient light intensity by a color sensor.
Always returns 0 (error log is outputted) when an invalid sensor number is specified.
port | Sensor port to be inquired |
colorid_t ev3_color_sensor_get_color | ( | sensor_port_t | port | ) |
Get the color by a color sensor.
Always return COLOR_NONE (error is outputted) when an incorrect sensor number is specified.
port | Sensor port to be inquired |
uint8_t ev3_color_sensor_get_reflect | ( | sensor_port_t | port | ) |
Get the reflect light intensity by a color sensor.
Always returns 0 (error log is outputted) when an invalid sensor number is specified.
port | Sensor port to be inquired |
void ev3_color_sensor_get_rgb_raw | ( | sensor_port_t | port, |
rgb_raw_t * | val | ||
) |
Get the RGB raw value by a color sensor.
If an invalid sensor number is specified, val is not updated (error log is output).
port | Sensor port to be inquired |
val | Pointer for storing sensor value |
int16_t ev3_gyro_sensor_get_angle | ( | sensor_port_t | port | ) |
Get the angular position by a gyroscope sensor.
Always returns 0 (error log is outputted) when an invalid sensor number is specified.
port | Sensor port to be inquired |
int16_t ev3_gyro_sensor_get_rate | ( | sensor_port_t | port | ) |
Get the angular speed by a gyroscope sensor.
Always returns 0 (error log is outputted) when an invalid sensor number is specified.
port | Sensor port to be inquired |
ER ev3_gyro_sensor_reset | ( | sensor_port_t | port | ) |
Reset the angular position of a gyroscope sensor to zero.
port | Sensor port to be reset |
E_OK | Successful completion |
E_ID | Illegal sensor port number |
int8_t ev3_infrared_sensor_get_distance | ( | sensor_port_t | port | ) |
Get the distance using the infrared sensor.
Always returns 0 (error log is outputted) when an invalid sensor number is specified.
port | Sensor port to be inquired. |
ir_remote_t ev3_infrared_sensor_get_remote | ( | sensor_port_t | port | ) |
Gets commands from IR remote controllers.
When an invalid sensor support number is specified, always return 0 pattern (error log is output).
port | Sensor port to be inquired. |
ir_seek_t ev3_infrared_sensor_seek | ( | sensor_port_t | port | ) |
Gets values to seek a remote controller in beacon mode.
When an invalid sensor support number is specified, always return 0 direction and distance of -128 (error log is output).
port | Sensor port to be inquired. |
ER ev3_sensor_config | ( | sensor_port_t | port, |
sensor_type_t | type | ||
) |
Configure a sensor port.
Always returns 0 when an invalid sensor number is specified.
port | Sensor port to be configured |
type | Sensor type for the specified sensor port |
E_OK | Successful completion |
E_ID | Illegal sensor port number |
E_PAR | Illegal sensor type |
ER_UINT ev3_sensor_get_type | ( | sensor_port_t | port | ) |
Get the type of a sensor port.
port | Sensor port to be inquired |
>=0 | Specified sensor type of supported sensor |
E_ID | Incorrect sensor port number |
bool_t ev3_touch_sensor_is_pressed | ( | sensor_port_t | port | ) |
Get the status of a touch sensor.
When an invalid sensor support number is specified, always returns false (error log is output)
port | Sensor port to be inquired |
true | Pressed pressed |
false | Unpressed pressed |
int16_t ev3_ultrasonic_sensor_get_distance | ( | sensor_port_t | port | ) |
Get the distance by a ultrasonic sensor.
Always returns 0 (error log is outputted) when an invalid sensor number is specified.
port | Sensor port to be inquired |
bool_t ev3_ultrasonic_sensor_listen | ( | sensor_port_t | port | ) |
Get a ultrasonic signal by a ultrasonic sensor.
When an invalid sensor support number is specified, always returns false (error log is output).
port | Sensor port to be inquired |
true | A signal has been received |
false | No signal has been received |
bool_t ht_nxt_accel_sensor_measure | ( | sensor_port_t | port, |
int16_t | axes[3] | ||
) |
Measure acceleration with a HiTechnic NXT acceleration sensor.
When an invalid sensor support number is specified, always returns false (error log is output)
port | Sensor port to be inquired |
axes | Array to store the x/y/z axes data |
true | Axes [] is updated |
false | Axes[] is unchanged due to I2C busy |
bool_t nxt_temp_sensor_measure | ( | sensor_port_t | port, |
float * | temp | ||
) |
Measure temperature with a NXT temperature sensor (9749).
When an invalid sensor support number is specified, always returns false (error log is output)
port | Sensor port to be inquired |
temp | Variable to store the temperature value |
true | Temp is updated) |
false | Temp is unchanged due to I2C busy |