Can someone help me with using the HC-SR04 as a switch please?

24 views
Skip to first unread message

Lance Maddux

unread,
Oct 16, 2017, 1:47:40 PM10/16/17
to Ardublock
(I'm using Ardublock) My only purpose of using the arduino is to sequence my traffic light collection which I've got the timing of the lights and the sequences down packed but I am trying something new. I tried using a PIR motion sensor to do an if/then-else sequence where if motion is detected, my signal will do a green light cycle with an accompanying yellow and red cycle and if no motion is triggered, a flashing yellow arrow for a certain amount of time then a solid yellow and red cycle, but I could never get the PIR motions sensor to work right (cheap chinese ones). So I invested in a HC-SR04 proximity sensor and I am having the same headache. All I would like to learn is how to use the HC-SR04 as a switch so that when there is motion, my signal will turn green and if no motion, will flash yellow. Thanks!
Reply all
Reply to author
Forward
0 new messages