0Pricing
Arduino & IoT Academy · Lesson

Build a Proximity Alarm

Buzz when something gets too close.

Turn Range Into Action

You can read distance, so now react to it. A proximity alarm buzzes the moment something comes too close to the sensor. 🚨

Add a Buzzer

Wire a small buzzer to a digital pin and to ground. Driving that pin HIGH makes a sound, and LOW makes it stop.

const int buzzerPin = 8;

All lessons in this course

  1. How Ultrasonic Ranging Works
  2. Trigger & Echo Wiring
  3. pulseIn to Time the Echo
  4. Build a Proximity Alarm
← Back to Arduino & IoT Academy