I have 2 LEDs that I want to react to a boolean signal. LED1 should light up as soon as the signal is TRUE and stay lit for 5s after it switches FALSE. If the signal goes TRUE again before 5s LED1 should stay lit. LED2 is lit when the signal is FALSE and then switches off when it switches TRUE. It only switches TRUE again when LED1 is off i.e. it is the logical NOT of LED1.
The part I'm struggling with is getting LED1 to stay on for a 5s delay after the boolean signal switches. I know roughly how this will work - I think I need to grab the timestamp at the signal switch and then keep comparing it against a constantly updating timestamp.
Can anyone help? Thanks!