Hello, I'm requesting some guidance with some programming for my arduino.
I currently can't make my relay work the way it should work. It's kind of hard to explain but let me try to explain it plain and simple.
My arduino is connected to 2 seperate switches(press and release, when pressed it's on. When released it's off). My arduino is also connected to 2 relay's that would drive a motor for given amount of time.
Here comes the hardest part >
When arduino turns on it should check if the button 1/2 is pressed. If yes then no action should be taken and the relays should be turned off.
If switch 1/2 turns off then a delay function for 40-50 seconds (that's not a defined time yet.)
After the delay (40-50 seconds the switch is turned off) then the relay should turn on automaticly even when button is not triggered. It would press both switches (1/2) on. Then there needs to be a delay before turning off. Around 30 seconds(not defined.)
After that the cycle repeats. It's important that it would check it's on funtion what the switch's mode is at certain cycles.
I tried programming the code above but I can't seem to get it working properly. Can any one please help me out?
I've tried programming with delay's and if / when statements. After a day of failures I threw it out of the window haha. In the pictures you can clearly see that the 3D printed part triggers a switch when the tube runs thru the part. When the switch gets triggered it the motor that drives the tubes should turn off after a certain amount of time. When the tubes are removed from the 3D printed part the switches turn off. At that moment I need a delay for a certain amount of time and then it should automatically turn on untill the switch is pressed ( If switch is pressed then also the motor should run for a few more seconds to give the ability to have some work space for the tubes).
I know this is all a bit confusing but all help is Appreciated big time, I can't seem to work it out.
Hello tjarec
Post your sketch, well formated, with comments and in so called code tags "</>" and schematic to see how we can help.
Have a nice day and enjoy coding in C++.