EV3RT C API Reference [English]
An RTOS-based development platform for LEGO Mindstorms EV3.
 All Data Structures Functions Variables Enumerations Enumerator Groups
ev3api_sensor.h
1 
19 #pragma once
20 
28 typedef enum {
29  EV3_PORT_1 = 0,
30  EV3_PORT_2 = 1,
31  EV3_PORT_3 = 2,
32  EV3_PORT_4 = 3,
35 
43 typedef enum {
54 
62 typedef enum {
63  COLOR_NONE = 0,
65  COLOR_BLUE = 2,
68  COLOR_RED = 5,
72 } colorid_t;
73 
81 typedef struct {
82  uint16_t r;
83  uint16_t g;
84  uint16_t b;
85 } rgb_raw_t;
86 
107 
121 ER_UINT ev3_sensor_get_type(sensor_port_t port);
122 
137 
152 
167 
182 
197 
212 
227 
242 
259 
267 typedef struct {
268  int8_t heading[4];
269  int8_t distance[4];
270 } ir_seek_t;
271 
272 #define IR_RED_UP_BUTTON 1
273 #define IR_RED_DOWN_BUTTON 2
274 #define IR_BLUE_UP_BUTTON 4
275 #define IR_BLUE_DOWN_BUTTON 8
276 #define IR_BEACON_BUTTON 16
277 
278 typedef struct {
279  uint8_t channel[4];
280 } ir_remote_t;
281 
296 
311 
326 
343 
361 bool_t ht_nxt_accel_sensor_measure(sensor_port_t port, int16_t axes[3]);
362 
380 bool_t nxt_temp_sensor_measure(sensor_port_t port, float *temp);
381 
bool_t ht_nxt_accel_sensor_measure(sensor_port_t port, int16_t axes[3])
Measure acceleration with a HiTechnic NXT acceleration sensor.
Definition: ev3api_sensor.c:441
Port 3.
Definition: ev3api_sensor.h:31
ER_UINT ev3_sensor_get_type(sensor_port_t port)
Get the type of a sensor port.
Definition: ev3api_sensor.c:138
colorid_t ev3_color_sensor_get_color(sensor_port_t port)
Get the color by a color sensor.
Definition: ev3api_sensor.c:157
int16_t ev3_ultrasonic_sensor_get_distance(sensor_port_t port)
Get the distance by a ultrasonic sensor.
Definition: ev3api_sensor.c:283
Number of sensor types.
Definition: ev3api_sensor.h:52
Structure for IR Seek values for all 4 channels.
Definition: ev3api_sensor.h:267
void ev3_color_sensor_get_rgb_raw(sensor_port_t port, rgb_raw_t *val)
Get the RGB raw value by a color sensor.
Definition: ev3api_sensor.c:206
ER ev3_gyro_sensor_reset(sensor_port_t port)
Reset the angular position of a gyroscope sensor to zero.
Definition: ev3api_sensor.c:260
HiTechnic NXT acceleration sensor.
Definition: ev3api_sensor.h:50
uint8_t ev3_color_sensor_get_ambient(sensor_port_t port)
Get the ambient light intensity by a color sensor.
Definition: ev3api_sensor.c:190
Port 1.
Definition: ev3api_sensor.h:29
uint16_t r
Red value.
Definition: ev3api_sensor.h:82
bool_t ev3_ultrasonic_sensor_listen(sensor_port_t port)
Get a ultrasonic signal by a ultrasonic sensor.
Definition: ev3api_sensor.c:302
int8_t ev3_infrared_sensor_get_distance(sensor_port_t port)
Get the distance using the infrared sensor.
Definition: ev3api_sensor.c:325
Not connected.
Definition: ev3api_sensor.h:44
Black.
Definition: ev3api_sensor.h:64
bool_t nxt_temp_sensor_measure(sensor_port_t port, float *temp)
Measure temperature with a NXT temperature sensor (9749).
Definition: ev3api_sensor.c:463
ir_remote_t ev3_infrared_sensor_get_remote(sensor_port_t port)
Gets commands from IR remote controllers.
Definition: ev3api_sensor.c:366
ER ev3_sensor_config(sensor_port_t port, sensor_type_t type)
Configure a sensor port.
Definition: ev3api_sensor.c:86
Yellow.
Definition: ev3api_sensor.h:67
int16_t ev3_gyro_sensor_get_angle(sensor_port_t port)
Get the angular position by a gyroscope sensor.
Definition: ev3api_sensor.c:228
sensor_port_t
Enumeration type for supported sensor ports.
Definition: ev3api_sensor.h:28
Definition: ev3api_sensor.h:278
int16_t ev3_gyro_sensor_get_rate(sensor_port_t port)
Get the angular speed by a gyroscope sensor.
Definition: ev3api_sensor.c:244
NXT temperature sensor.
Definition: ev3api_sensor.h:51
uint16_t b
Blue value.
Definition: ev3api_sensor.h:84
uint8_t ev3_color_sensor_get_reflect(sensor_port_t port)
Get the reflect light intensity by a color sensor.
Definition: ev3api_sensor.c:174
bool_t ev3_touch_sensor_is_pressed(sensor_port_t port)
Get the status of a touch sensor.
Definition: ev3api_sensor.c:426
Number of sensor ports.
Definition: ev3api_sensor.h:33
ir_seek_t ev3_infrared_sensor_seek(sensor_port_t port)
Gets values to seek a remote controller in beacon mode.
Definition: ev3api_sensor.c:341
Touch sensor.
Definition: ev3api_sensor.h:47
colorid_t
Enumeration type for colors that can be detected by color sensor.
Definition: ev3api_sensor.h:62
Green.
Definition: ev3api_sensor.h:66
uint16_t g
Green value.
Definition: ev3api_sensor.h:83
Blue.
Definition: ev3api_sensor.h:65
Red.
Definition: ev3api_sensor.h:68
Color sensor.
Definition: ev3api_sensor.h:48
Brown.
Definition: ev3api_sensor.h:70
Gyroscope sensor.
Definition: ev3api_sensor.h:46
None.
Definition: ev3api_sensor.h:63
Ultrasonic sensor.
Definition: ev3api_sensor.h:45
White.
Definition: ev3api_sensor.h:69
Port 4.
Definition: ev3api_sensor.h:32
Number of colors.
Definition: ev3api_sensor.h:71
Structure for an RGB raw value.
Definition: ev3api_sensor.h:81
Port 2.
Definition: ev3api_sensor.h:30
sensor_type_t
Enumeration type for supported sensor types.
Definition: ev3api_sensor.h:43
Infra-Red sensor.
Definition: ev3api_sensor.h:49