Skip to content

Instantly share code, notes, and snippets.

@li2hub
Last active July 21, 2018 11:02
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 li2hub/de51f379c2f37ff25b5e4e39c6804f08 to your computer and use it in GitHub Desktop.
Save li2hub/de51f379c2f37ff25b5e4e39c6804f08 to your computer and use it in GitHub Desktop.
const int buzzer = 8; //buzzer to arduino pin 8
void setup(){
pinMode(buzzer, OUTPUT); // Set buzzer - pin 8 as an output
}
void loop(){
tone(buzzer, 1000); // Send 1KHz sound signal...
delay(1000); // for 1 sec
noTone(buzzer); // Stop sound
delay(1000); // for 1sec
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment