Skip to content

Instantly share code, notes, and snippets.

@recursivecodes
Created October 12, 2018 14:54
Show Gist options
  • Save recursivecodes/63dac281f94dd8a4095dc7e51c2ebf86 to your computer and use it in GitHub Desktop.
Save recursivecodes/63dac281f94dd8a4095dc7e51c2ebf86 to your computer and use it in GitHub Desktop.
void loop() {
int read = analogRead(SENSOR);
Serial.println(read);
if( read > 50 ) {
Serial.println("on");
digitalWrite(LED,HIGH);
tone(BUZZER, 10);
delay(100);
}else {
digitalWrite(LED,LOW);
noTone(BUZZER);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment