or how to schedule something to happen X seconds later.
There has to be a pattern to handle "this" although I'm struggling to understand/define exactly what this is I'm having trouble with.
When the door opens, the light should stay on for 60 seconds.
or if the button is pressed, turn the light off 30 seconds later.
every door open resets the 60 seconds.
(this is the simplified version that I think is the root of my problem)
master process keeps track of the state of doors and lights.
doors and lights don't know state.
doors and buttons send activity messages, lights listen for on/off messages.
door sensor sends "open" message.
master's on_open sends "light on" message and stores the time.
on_buitton sends "light off"
I can't do "on, sleep(60), off" because that will block the on_button (right?)
and when the button is pressed, if the door opens again that should disable the "off in 30" thing.
Is there a tutorial page or something I should be reading?