I am using wiringPi
Library and using this library to read data from GPIO Pins attached to a PIR Sensor.
I am using a while loop which reads input data. If there is a motion it will print motion.
while(1)
{
while(digitalRead(1)==0)
check=false;
if(check==false)
{
cout<<"Motion Detected"<<endl;
check=true;
}
}
The above code uses processor 100%
.
What to do in this case? How can I reduce my processor usage.?