
Arduino & Neopixels Code Fix
- or -
Post a project like this2814
£50(approx. $63)
- Posted:
- Proposals: 1
- Remote
- #1556834
- Completed
Description
Experience Level: Entry
I'm using an Arduino Uno R3 and have a string of 300 neopixels from Adafruit, I'm planning to use them in my office to light the underside of some cabinets.
My current source code is on Pastebin https://pastebin.com/S9beV4nK , which for the most part seems to work. but I just cannot crack this last part as I'm totally new to the Arduino world.
What id like to do 2 things which right now I just cannot figure out. Firstly, il explain my loop.
Once motion is detected from the PIR sensor, there's a quick rainbow show on the LED’s, then the light is set to all white for 5 seconds and a motion reading is taken again, if no more motion is detected then it will fade to a dim white and then flick to a dim red. If motion was detected it will show the rainbows again and then show the white light again for 5 seconds as previously mentioned.
What I want it to do is this... Detect Motion > Show rainbows on LED’s > Show white for 5 seconds and take a motion reading > If no motion detected Fade down to a dim red > once motion has been detected, loop back to the start with the rainbow light show.
The difficulty here is that once the light has gone white, if the sensor retriggers (motion is still present after the 5 second timeout) then it shows the rainbow pattern again, this is what I want to stop. The rainbows should only be displayed once the system has not detected motion for a while and has gone into its standby mode (dim red), if it retriggers when the white light is already on, it should simply keep the white lights on, wait for the 5 second timer to elapse and check again, not show the rainbows again.
Also, the fade part doesn’t really work, and I cant seem to get it to fade from full white to a dim red directly and it fades FAR too slowly, I want it to fade within about 10-15 seconds
I have done some research and found examples such as Blink Without Delay, but I just cant wrap my head around it and just want it sorted now! I was hoping you could use my existing code as an indication of what id like to achieve. Its almost like i need a loop within a loop, but im not used to programming in Arduino or working with single thread CPU's.
I have the hardware working and ready to go, so i can allow you remote access to a machine with the arduino and neopixels connected if this speeds up/helps things.
Could you let me know if you can help and if so a rough cost?
My current source code is on Pastebin https://pastebin.com/S9beV4nK , which for the most part seems to work. but I just cannot crack this last part as I'm totally new to the Arduino world.
What id like to do 2 things which right now I just cannot figure out. Firstly, il explain my loop.
Once motion is detected from the PIR sensor, there's a quick rainbow show on the LED’s, then the light is set to all white for 5 seconds and a motion reading is taken again, if no more motion is detected then it will fade to a dim white and then flick to a dim red. If motion was detected it will show the rainbows again and then show the white light again for 5 seconds as previously mentioned.
What I want it to do is this... Detect Motion > Show rainbows on LED’s > Show white for 5 seconds and take a motion reading > If no motion detected Fade down to a dim red > once motion has been detected, loop back to the start with the rainbow light show.
The difficulty here is that once the light has gone white, if the sensor retriggers (motion is still present after the 5 second timeout) then it shows the rainbow pattern again, this is what I want to stop. The rainbows should only be displayed once the system has not detected motion for a while and has gone into its standby mode (dim red), if it retriggers when the white light is already on, it should simply keep the white lights on, wait for the 5 second timer to elapse and check again, not show the rainbows again.
Also, the fade part doesn’t really work, and I cant seem to get it to fade from full white to a dim red directly and it fades FAR too slowly, I want it to fade within about 10-15 seconds
I have done some research and found examples such as Blink Without Delay, but I just cant wrap my head around it and just want it sorted now! I was hoping you could use my existing code as an indication of what id like to achieve. Its almost like i need a loop within a loop, but im not used to programming in Arduino or working with single thread CPU's.
I have the hardware working and ready to go, so i can allow you remote access to a machine with the arduino and neopixels connected if this speeds up/helps things.
Could you let me know if you can help and if so a rough cost?

Chris H.
100% (15)Projects Completed
13
Freelancers worked with
11
Projects awarded
67%
Last project
7 May 2023
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
Thankyou Chris for inviting me to your job, but i have no experience of arduino programming.
406892
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies