First I have had this Arduino UNO board for years. I had originally bought it to control my brewing system and my still. But never got around to it. So I found it in some of my electronic stuff and figured I would give it a go. Last time I looked at any code was around 1990. And that was just in code reviews when I was working. Yada yada yada. So lets just say newbie.
I am trying to use the board to monitor my reloading press operation. Its pretty simple but after trying several different strategies I am stumped. I get it to work kinda on the test bed but not on the machine. And I managed to save 21 sketches that none work completely. And they are messy with commented out trys.
So here I go.
There are
3 IR Sensors - RAM TOP, RAM BOTTOM and POWDER SENSE (Output normally HIGH)
1 LED Output
1 Reset Button
The operation is as follows.
The RAM is at rest at the bottom.
Manually the RAM is raised to the TOP and if the POWDER SENSOR is TRUE the program does nothing. And you continue with the next stroke.
If the RAM is raised to the TOP and the POWDER SENSOR is FALSE the the LED goes HIGH.
Then the RESET BUTTON is used to set the LED to LOW.
I have tried IF's, nested IF's, ELSE IF's.
I can never get the sequence to work properly.
If the POWDER SENSE doesn't come in simultaneously with the RAM at the TOP its doesn't work.
The 3 sensors need to be read in sequence. Once the BOTTOM sensor goes LOW the the next one has to be the TOP then the POWDER.
Even if I get it to partially work I can never get the LED to go LOW with the BUTTON press.
Eventually I am going to put a counter in to pull another pin high and a solenoid to stop the ram from operating.
At this point I am not looking for the complete operational code, just some examples and ideas how to do it.
Thanks