Separated Qt and WiringPi code in blink thread
This commit is contained in:
parent
d2e774fe5c
commit
488d4c8f71
6 changed files with 52 additions and 12 deletions
|
@ -1,22 +1,21 @@
|
|||
#include "blinkthread.h"
|
||||
#include <wiringPi.h>
|
||||
#include "led.h"
|
||||
|
||||
BlinkThread::BlinkThread()
|
||||
BlinkThread::BlinkThread(unsigned int pin)
|
||||
: m_led(pin)
|
||||
{
|
||||
wiringPiSetup();
|
||||
pinMode(m_blinkPin, OUTPUT);
|
||||
}
|
||||
|
||||
void BlinkThread::run()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
digitalWrite(m_blinkPin, HIGH);
|
||||
m_led.on();
|
||||
emit ledOn();
|
||||
delay(500);
|
||||
msleep(500);
|
||||
|
||||
digitalWrite(m_blinkPin, LOW);
|
||||
m_led.off();
|
||||
emit ledOff();
|
||||
delay(500);
|
||||
msleep(500);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue