I am trying to make a circuit that will be used for turning on a light whenever there are 1 or more people in a room. I need to add to a variable counter when someone enters and subtract when someone leaves. However, I do not know how to use the ultrasonic sensor for this purpose. What can I do?

  • Google. If you know how to use the Ultrasonic sensor and know the C++ basics, this will be very easy. May 7, 2021 at 7:09
  • How do you find out whether the person is entering or exiting May 7, 2021 at 7:15
  • Is there some distance change thing May 7, 2021 at 7:16
  • You'd have to place two Sensors next door, and if both are triggered, someone got in or out. You can check whether the person went in or out by looking what Sensor was triggered first. May 7, 2021 at 7:18
  • thanks for the help May 7, 2021 at 7:26

1 Answer 1


See this tutorial on the Arduino Projecthub, that project was already made. Here is a tutorial how to use a Ultrasonic sensor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.