arduino - Can the PIR sensor work without loop? -


void setmanual(){ //do turn on , off light } void setauto(){   for(;;){      digitalread(pirpin); //read data pir      digitalwrite(ledpin, pirvalue); // turn on , of light follow pir's data   } } 

my problem when call setauto(), cannot go method.
have no idea this. so, can pir sensor work without loop? or how can break loop go method?

you cannot go method because

for(;;) 

is infinite loop.

you can read sensor using timer, elapsed millis, in in main loop() statement perhaps delay in between. lots of ways it. entering infinite loop in separate not want program matures completion. main loop() in arduino code infinite loop , 1 should use.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -