First project and thought I was almost done. Capacitive touch not registering when SetupPoliceCarPalette running. I know what I did is clumsy and probably doesn’t allow the touch sensor to register while running but this is my first Arduino project and I can not figure out another way to do it. I thought this would be a weekend project but 3 weeks later I am stuck. My girlfriend’s kids got rc Ford Raptors like my truck and since I have blue leds underneath my truck they wanted the same. I decided since I have had these mega boards sitting around for 2 years now that this would be the perfect chance to dive into the arduino. I am losing more hair daily from the kids asking when it will be done. Please help or show me where I can get help. I am 39 and can’t afford to lose any more hair.
Hi @Jerry_Kiley what is the desired function?
@Stuart_Taylor Thank you for your time. While the police light sequence is running I need the capacitive touch sensor to register a touch and goto the next light sequence. It works with all the other animations but for some reason it won’t register the touch while running the code I wrote. I have spent a week trying to figure out another way to code it so it will work to no avail.
@Jerry_Kiley so, if its lit orange and you touch it, it will change to the next color?
But when it does its flashing police animation it doesnt respond to touch?
It’s because all the other code does a single frame at a time then checks for touch events then does the next frame, etc… but your function runs through all the frames of its animation and never checks for touches.
+Daniel Garcia thank you. how can I change my code to make it correct?
Explaining how to re-arrange your code so that it writes a frame at a time and returns is a bit out of the scope of a single g+ comment, unfortunately (at least, what I have the time/space for doing right now). But one thing that you could do, though it would add a lot of code, is regularly check the capacative button, ideally before each show, to see whether or not you need to return from your function early and move on to the next thing.
@Daniel_Garcia thank you, I had tried that but for some reason I couldn’t get it to work. This is my first time writing code so I probably did something wrong.