View Full Version : Blink LED for 5 seconds with 1Hz rate
sammey_geek
21st September 2013, 07:52
hi
i want to toggle LED for 5 seconds like ON and OFF. with 1 hz rate... can anyone give me suggestion..how to do that??
thanks
Sammey
wysota
21st September 2013, 08:59
Write code that will be triggered once a second (e.g. using a timer) that toggles the led.
aamer4yu
21st September 2013, 10:07
How are you controlling the LED ? Qt cannot do that directly.
For the logic,,
myclass::myclass()
{
timer.setInterval(1000); // 1Hz = 1 sec
}
void startBlinkLED()
{
timer.start()
count = 0;
}
void onTimerTimeout()
{
if( count++ > 5)
{ count = 0;
timer.stop();
return;
}
led->blink(); // Actual API to be called
}
sammey_geek
21st September 2013, 12:11
i work on linux platform
for turning on led system("echo 1 > /sys/class/leds/highbright-led/brightness")
and turning off system("echo 0 > /sys/class/leds/highbright-led/brightness")
anyway tanx for the reply aamer4yu ..i wil make some changes and i will check whether it is working or not... :)
andre_teprom
21st September 2013, 12:57
sammey,
It is unusual perform control of hardware devices at X86 platform, as was implicitly mentioned by aamer4yu.
I presume you are working on some embedded linux platform such as an ARM one.
If the case, take a look on source code examples which is commonly provided at design tool ( hello word / blink led / etc... )
+++
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.