Little Bird Curriculum / code littlebird.com.au
eagled-buzzer-3d.ino Arduino (C/C++) 15 lines · 0 views ✦ Open in English IDE Raw Download Embed view
const byte BUZZER_PIN = 12;
const unsigned int NOTES[] = {523, 659, 784};
const unsigned long NOTE_MS = 300;
const unsigned long GAP_MS = 200;
void setup() { pinMode(BUZZER_PIN, OUTPUT); }
void loop() {
  for (byte i = 0; i < 3; i++) {
    tone(BUZZER_PIN, NOTES[i]);
    delay(NOTE_MS);
    noTone(BUZZER_PIN);
    digitalWrite(BUZZER_PIN, LOW);
    delay(GAP_MS);
  }
  delay(500);
}

Embed this snippet

As an iframe:

Or drop it inline with a script tag (injects the highlighted block where included):

Shared from Little Bird Electronics curriculum.

Copied to clipboard