Examples
The examples in this section intend to show additional aspects of coding for the EV3 motors and sensors. To that end, they introduce the concept of execution loops and sampling period. The sensor data is often recorded to be plotted at the end.
Always try to see what the sensors are seeing. Looking at your data as a function of time is a good starting point. It will help understand why things work (or sometimes don’t) as expected.
Example |
Brief Description |
---|---|
Run a sinusoidal motor speed output |
|
Run a sinusoidal speed output for two motors |
|
Use the touch sensor as an event counter |
|
Detect the relative light intensity of a flashlight |
|
Detect an obstacle using the ultrasonic sensor |
|
Track the LEGO® infrared beacon |
|
Measure angular position and velocity using a gyro |
Note
For best graphic display of the results, consider running them in an interactive Jupyter notebook session (instead of a plain old terminal window).