Before compiling the following programs, readers must follow the steps shown in the “Hardware Interaction” section.
The EV3 motors can be accessed using simple write file operations. Internally the program interacts with the kernel module d_pwm. More details about the use of motors can be found in the d_pwm.c file, inside the function Device1Write. The following program shows how to initialize, and use the motors in different modes, as well as how to read the encoder sensors:
– Open loop control
– Closed loop control
– Reading encoders