I don’t know if there’s an “ideal” value for a pulldown resistor for this. If it was me, I’d probably use a 4.7K or 10K? Mainly, because those are values I frequently see mentioned for this purpose.
I did spend some time yesterday looking over the code. The only thing I really spotted was that in the relayControl() function, passing ‘r1’ or ‘r2’ will toggle pins 0 and 1, so probably not the correct pins. The state logic seems okay, though there’s some weirdness with the code blocks for state == 2. It won’t break anything, but it looks like the product of code that was rewritten a few times, but never cleaned up? I’d probably clean it up like so:
Thanks for the code editing help. I removed the extra braces from state == 2. Not sure about what to do for the r1 and r2 in the relayControl() function, so I left it alone.
received the new photon 1/2 hr ago, flashed the code, and everything is behaving as intended. Perhaps the last photon was dropped or otherwise damaged? We may never know. I am hopeful that when I assemble the prop later everything will still work well.
Thanks for the coding help. I assembled the prop with the new photon and everything works great. I sincerely appreciate all of the help. After all the troubleshooting, it appears to have been a bad photon.
That is quite possible. I was using an older computer power supply to power the 12 vdc actuators and the 5vdc motion sensor. The power supply fan stopped working, and is dead now. I think that when it died, it sent the 5v to ground and made my photon a very light paperweight.
All is well now with a new photon and a quality 5v power supply. The prop is actually pretty cool, already scared the neighbor when he walked up to it. I’ll post a video when we do our dry run next weekend.