Robotics & Arduino
Lesson 3 · Hands on

Project 07

Ultrasonic — distance LEDs

What do we want to do?

Show distance ranges using colored LEDs.

Parts

  • Arduino Uno + USB cable, breadboard, and jumper wires.
  • HC-SR04 ultrasonic sensor
  • 4 colored LEDs and 4 × 330Ω resistors

What to expect

Yellow between 2 and 20 cm, green at 20–30 cm, and red above 30–50 cm. Blue indicates a timeout or the blind zone. Beyond 50 cm, LEDs stay off.