I am struggling to find out how to triger (reset) a timer element to perform some action some time after another action. For example I want to have the backlight off, set it to high after the touch button is touched and dim it again after 3 seconds.
I am able to let the Interval element cycle but this would mean the backlight is switched off in ramdom intervals after the button is touched. I would like to have it always in let's say 3 seconds after the touch happened.
How to reach this?
Ho
I recognized the Interval is confusing on this - I used it too the first time to create a delay but it is not the right way
There is currently no element to implement a 'real' dealy.
You have to append the code in the code editor to do that.
See for example how the buzzer sound duration is set in the code:
ATMO_Status_t EmbeddedNxpRpkBuzzer_beep(ATMO_Value_t *in, ATMO_Value_t *out) {
ATMO_MK64F_Buzzer_On();
ATMO_PLATFORM_DelayMilliseconds(200);
ATMO_MK64F_Buzzer_Off();
return ATMO_Status_Success;
You have to call ATMO_PLATFORM_DelayMilliseconds()
You might also check the code for
ATMO_DelayMillisecondsNonBlock()
but I never used this one myself.
Hi Vilem,
I am understanding, your application or only this button, it will on/off the Light and if the user touch the button for 3 seconds, the user will be able to dimmer the light, isn't it?
But, I am not following this requirement.
"I am able to let the Interval element cycle but this would mean the backlight is switched off in random intervals after the button is touched. I would like to have it always in let's say 3 seconds after the touch happened."
Regards,
Mario
I want to reach this: After (a short) touch is the backlight switched on an goes off in 3 seconds (if no other touch detected).
So the touch should 1) switch the light on and 2) start/reset the 3 seconds countdown interval.
...and I am not able to really control the interval behaviour.