title: Can the PIR sensor work without loop?
body: <pre class="lang-cpp prettyprint-override"><code>void setManual(){
  //do something like turn on and off the light
  }
  void setAuto(){
    for(;;){
       digitalRead(pirPin); //read data from PIR
       digitalWrite(ledPin, pirValue); // turn on and of the light follow the PIR's data
    }
  }
  </code></pre>
  
  <p>My problem is when I call the <code>setAuto()</code>, then I cannot go to another method.<br>
  I have no idea about this. So, can the PIR sensor work without loop? Or how can I break this loop for go to another method?</p>