Block6 tutorials

Sensors & Modules with Blocks

Read distance, light, and line sensors with blocks and use the data to make decisions.

Measure Distance

IntermediateBlock

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.

DistanceHC-SR04SensorOLEDIntermediate

Distance Alert

IntermediateBlock

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.

DistanceHC-SR04SensorLEDBuzzerIntermediate

Detect a Line

IntermediateBlock

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.

Line SensorTCRT5000SensorLEDIntermediate

Read the Light Level

IntermediateBlock

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.

Light SensorPT19SensorLEDOLEDIntermediate

Trimpot as a Controller

IntermediateBlock

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.

TrimpotAnalogSensorLEDIntermediate

Read Temperature & Humidity

IntermediateBlock

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.

SHT40TemperatureHumiditySensorOLEDIntermediate