Python5 tutorials

Projects with Python

Build complete Python projects that combine sensors, motors, and the display into real robots.

Distance Display

IntermediatePython

Build a polished live distance display using the HC-SR04 sensor and the OLED screen. Add a visual bar that grows and shrinks with distance, and colour-code the LED to give an at-a-glance range indicator.

DistanceHC-SR04OLEDDisplayProjectIntermediate

Ultrasonic Alarm

AdvancedPython

Build a fully functional motion alarm. The buzzer frequency and LED colour escalate as an intruder gets closer — three alarm zones with distinct sounds and lights.

DistanceHC-SR04AlarmBuzzerLEDProjectAdvanced

Reaction Time Game

AdvancedPython

Build a reaction time game in Python. A random delay ends when the GRN LED lights — press Switch A as fast as you can! Your reaction time is measured in milliseconds using `time.ticks_ms()` and displayed on the OLED.

TimingRandomSwitchesOLEDGameProjectAdvanced

Line Follower in Python

AdvancedPython

Program a line-following robot in Python. Read both TCRT5000 sensors, classify the robot's position relative to the line, and steer the motors accordingly — four states, clean functions, smooth following.

Line SensorMotorsSteeringRobotFunctionsProjectAdvanced

Robot Dance

AdvancedPython

Choreograph a full robot performance combining motor moves, LED lights, and buzzer music. Store the dance as a list of scripted moves and play them in sync with a melody.

MotorsLEDBuzzerChoreographyListsFunctionsProjectAdvanced