Sensors & Modules with Blocks
Read distance, light, and line sensors with blocks and use the data to make decisions.
Measure Distance
Read the HC-SR04 ultrasonic sensor and display the live distance on the OLED. Watch the number change as you move your hand closer and farther from the board.
Distance Alert
Apply a threshold to the distance sensor: light a LED and sound the buzzer when an object gets too close. This is the data → decision → action pattern in action.
Detect a Line
Use the left and right line sensors to detect a dark line on a light surface. Display the sensor states on the OLED and steer LEDs based on which sensor sees the line.
Read the Light Level
Read the PT19 ambient light sensor and display the value on the OLED. Apply a threshold to change LED colour based on whether the room is bright or dim.
Trimpot as a Controller
Read the onboard trim potentiometer as an analog input from 0 to 100. Use it to control LED brightness in real time — turn the knob, change the light.
Read Temperature & Humidity
Read the SHT40 temperature and humidity sensor built into the Beaver Board and display both values live on the OLED. Then use an if block to turn on the RED LED whenever the temperature gets too warm.