Skip to content

Instantly share code, notes, and snippets.

@blister
Last active January 20, 2019 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blister/a36b85c92acaea835fc1479fbf0f5c07 to your computer and use it in GitHub Desktop.
Save blister/a36b85c92acaea835fc1479fbf0f5c07 to your computer and use it in GitHub Desktop.
void loop() {
delay(50);
// See if an object is in front of us
int distance = msToCm(ping());
//Serial.println(distance);
if ( distance < detectionDistance ) {
// get a random song
playNote(NOTE_G5, 100, .1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment