How to triger (reset) a timer element (NXP Rapid IoT)?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to triger (reset) a timer element (NXP Rapid IoT)?

1,410 次查看
vilem
Contributor III

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?

NXP Rapid IoT - bakklighttimer.PNG

标签 (1)
0 项奖励
回复
3 回复数

1,250 次查看
frq05186
NXP Employee
NXP Employee

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.

0 项奖励
回复

1,250 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

1,250 次查看
vilem
Contributor III

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.

0 项奖励
回复