I have a project that I have been working on here and there for a few months now. I got it working properly, until I wanted to add more stuff into it. Here is what is going on:
I am using an arduino uno to power a linear actuator back and forth. I have a relay driver controlling it, but that doesn’t have anything to do with my code. I’m just trying to give a feel for what the project is. The linear actuator is moving a SPDT momentary switch back and forth. Then the signal from the switch lights up and LED. The amount of cycles is displayed on an LCD to keep track of how many times the switch has sent a signal. I started messing with it to test the switch. The company I work for wanted to know if it would live up to X amount of cycles.
The switch lived, and I got lucky because there was no feedback for the Uno to know if the switch had failed. What I am trying to include is an if else statement in the code that will add to the count if the signal is high, and break if the signal is low. I have included the code, and maybe someone can help me understand what I am doing wrong. I am rusty when it comes to coding, and I was trying to do my research to figure out why this isn’t working before I posted this.
Anything will help. I uploaded my code as it sits right now with me making changes and verifying.
toggle_switch_2.ino (2.39 KB)