2017-10-15 10:30:15 +00:00
|
|
|
#include "distancethread.h"
|
|
|
|
|
2017-10-16 14:51:08 +00:00
|
|
|
DistanceThread::DistanceThread(unsigned int triggerPin, unsigned int echoPin)
|
|
|
|
: m_hcsr04(triggerPin, echoPin)
|
2017-10-15 10:30:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void DistanceThread::run()
|
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
{
|
2017-10-16 14:51:08 +00:00
|
|
|
emit distanceUpdated(m_hcsr04.getDistance());
|
|
|
|
msleep(100);
|
2017-10-15 10:30:15 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-16 06:04:08 +00:00
|
|
|
|