This is worth capturing somwehere (from the EX-RAIL master):
Latch/unlatch is staggeringly simple...
There are 256 latches (64 on a Uno)
A latch can be LATCHed or UNLATCHed.
When exrail checks a sensor with IF , AT, AFTER etc it will first check the latch and if the latch is latched it will return true for the sensor without checking the hardware. This was originally designed to latch a pushbutton without having to deal with debouncing etc... hence the name.
The clever bit ...
If you test a sensor pin that does not exist then it returns false, unless of course it is latched!
So a latch is a very convenient way of setting a flag that can be tested later..... now you have the building block to play with.
Documentation details
This is worth capturing somwehere (from the EX-RAIL master):
Latch/unlatch is staggeringly simple... There are 256 latches (64 on a Uno) A latch can be LATCHed or UNLATCHed.
When exrail checks a sensor with IF , AT, AFTER etc it will first check the latch and if the latch is latched it will return true for the sensor without checking the hardware. This was originally designed to latch a pushbutton without having to deal with debouncing etc... hence the name.
The clever bit ... If you test a sensor pin that does not exist then it returns false, unless of course it is latched! So a latch is a very convenient way of setting a flag that can be tested later..... now you have the building block to play with.
Page with issues
No response