Lose the ; if (digitalRead(pirPin) == HIGH); Should be: if (digitalRead(pirPin) == HIGH) { // code here }