Hi Joe,everyone. Sorry for the slow reply, it's been one of those days today.
Before I forget I loved the line: "I think I smell what you are cooking" It's had me smiling all day.
Joe, the program you wrote. I was happy with all of it except line four.I see you've made GPIO.0 an input
but the 'THEN' label hasn't been given a HIGH or LOW statement for the pin
Code:
If GPIO.0 then unlock
To my mind (please be gentle with me I'm really green at this) it should be something like:
Code:
IF GPIO.0 = HIGH THEN UNLOCK ' GPIO.O goes HIGH (button pressed) jump to
label UNLOCK.
ELSE GOTO MAIN ' button not pressed do the loop again
(not sure if I needed the GOTO here).
Or maybe:
IF GPIO.O = LOW THEN MAIN ' button not pressed, do the loop again
Am I on the right lines here?
* Silly but important question here*: I'm confusing myself, can an INPUT be either HIGH or LOW?
I know an OUTPUT can be.
So your program is maybe a timed latching relay circuit or locking solenoid?
As for my program, I was thinking more along the lines that if GPIO.X goes high (a button is pressed +5v on that input pin) that would make an output on GPIO.Y go high. In other words the pressing of a button makes the program jump to some specified section of code making an output.
Then moving this idea on, if the button was pressed twice (within a certain time period say) you could 'jump' to another section of code and make a different output..
I hope you're all having a pleasant evening,
David
Bookmarks