____ __ ____ ___ ____ __ (((((() | |_ \ \ / ) ) | | ) | |_ \ \ / \(@)- / |_|__ \_\/ __)_) |_|_/ |_|__ \_\/ /(@)- \ ((())))
Low level contains functions for local and remote access to the file system of the EV3 brick. The following code will write "heartbeat"
string to the specified file (if running on the brick) or will send both of the arguments to the brick using UDP message (if running on the remote computer).
See also – io.c
For more information about remote access to the brick, please, read "ev3_link".
Mid-level provides the performance optimized library that is intended to cover all main functionality of "ev3dev".
To start working with the library, you have to call the library initialization ev3_init()
which will connect to the brick over network if your program is running on a remote computer, then, to detect devices plugged to the brick, please call initialization for each of the necessary class of devices, e.g. ev3_tacho_init()
. Do not forget to call ev3_uninit()
at the program end.
All functions to access the device's attributes require the sequence number of device sn
. You can find the sequence number in the descriptor table, which was filled during initialization, e.g. ev3_search_tacho(LEGO_EV3_L_MOTOR, &sn, 0)
.
Access to some frequently used string attributes can be performed by the index, for example, you can just check the mode index:
instead of string comparison:
See comprehensive example based on coroutines – drive.c
A few more examples:
• Using LEDs, see "Using LEDs":
See also – rcx_led.c
• Using sensors, see "LEGO Sensor Class":
See also – sensor.c
• Using tacho motors, see "Tacho Motor Class":
See also - tacho.c
• Using DC motors, see "DC Motor Class":
See also - dc.c
• Using servo motors, see "Servo Motor Class":
See also – servo.c
• Using EV3 ports, see "Input and Output Ports":
See also – port.c
• Using EV3 extended ports:
• Using keys of the EV3 brick:
"brick" library is a simplified interface of "ev3dev-c". We use a mask of sockets (ports) instead of sequence numbers for access to devices, it allows to set identical attributes of several devices concurrently, but extended ports are not supported.
See example of using "brick" library, based on coroutines – remote.c
A few more examples:
• Using "brick" library :
• Using light module:
See also – light.c
The libraries for Python, Ruby and Perl have been generated using SWIG. The SWIG interface file ev3.i
is generated out of ev3.yu-i
.
ev3_<class>_desc
or ev3_<class>_desc_<field>
functions (e.g. ev3_sensor_desc, ev3_port_desc);ev3
namespace.Using "brick" library with Python:
See also – Examples in Python
ev3_<class>_desc
or ev3_<class>_desc_<field>
functions (e.g. ev3_dc_desc, ev3_dc_desc_port).See also – Examples in Ruby
ev3_<class>_desc_<field>
functions (e.g. ev3_tacho_desc_type_inx, ev3_tacho_desc_port).See also – Examples in Perl
Similarly you can use SWIG to wrap the library in a number of other languages.