It's finally working! Took so many code rewrites.
BackgroundI am new to all of this open source electronics DIY stuff. I am a moderator for Hackster.io, and as a result, have become interested in the projects I review. I decided to make a motion activated night light for my bathroom. This way I don't have to turn on the bathroom light in the middle of the night, blinding myself every time go tinkle.
IntroductionI grabbed code from a few sources and compiled them together to make the attached code. With Ingo Lohs help, I saw where I was making a mistake. I was doing strip.clear, but not strip.show afterwards. Now it works like a beauty. I used hardware that I had laying around. No motion sensor was available, hence the Ultrasonic sensor.
Steps- connect the Ultrasonic sensor Grd to UNO Grd
- solder wires to Neopixel Grd, 5v, and Din
- plug Neopixel Grd wire to Grd on UNO
- join and solder Neopixel 5v wire and Ultrasonic sensor vcc to resistor to UNO 5v
- connect Ultrasonic sensor Trig to UNO pin 2
- connect Ultrasonic sensor Echo to UNO pin 3
- connect Neopixel Din to UNO pin 12
- Upload sketch
After a few easy connections to the UNO, you have a pretty night light that will activate when you walk in front of the Ultrasonic sensor. I hope this has helped those of you that want to use an Ultrasonic sensor as a motion detector. Adjust the distance for activation by altering the "if" loop cm = _____.
Comments
Please log in or sign up to comment.