37 lines
485 B
C++
37 lines
485 B
C++
#include "gpiodetect.h"
|
|
|
|
gpiodetect::gpiodetect(QObject *parent)
|
|
: QThread{parent}
|
|
{
|
|
|
|
}
|
|
|
|
void gpiodetect::run()
|
|
{
|
|
while(1)
|
|
{
|
|
QThread::sleep(2);
|
|
if(Status==true)
|
|
{
|
|
if(digitalRead(3)==1)
|
|
{
|
|
emit Pin_High(3);
|
|
}
|
|
else
|
|
{
|
|
emit Pin_Low(3);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void gpiodetect::Stop()
|
|
{
|
|
Status=false;
|
|
}
|
|
|
|
void gpiodetect::Start()
|
|
{
|
|
Status=true;
|
|
}
|