Separated Qt and WiringPi code in blink thread

This commit is contained in:
Michael Mandl 2017-10-16 15:23:54 +02:00
parent d2e774fe5c
commit 488d4c8f71
6 changed files with 52 additions and 12 deletions

View file

@ -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);
}
}