CSE: doo Doo DOO

Make the setup() function play a three-tone sequence, alerting the user that the sketch has finished uploading:

// dooDooDOO - play a three-tone alert in setup()
//
// This tone sequence is used at the start of the
// phone company's disconnected line message...

int oj_rc = 9;  // pin D9 drives the right channel

void setup() {
  pinMode(oj_rc, OUTPUT);

  my_tone(oj_rc,  894, 280);
  my_tone(oj_rc, 1351, 280);
  my_tone(oj_rc, 1756, 400);
}

void loop() {
  // nothing to do here.
}


void my_tone(int out_pin, int pitch, int duration) {
  tone(out_pin, pitch, duration);
  delay(duration);     // let tone() complete
}

//SYSIN DD DUMMY

Discussion

This sketch is very much like setup_alert(), save that:

  • It plays a 3-tone "disconnected line" sequence.
  • It uses a subroutine, for modularity.

The Uno's Pin 9 drives the Out Jack's "ring" (right channel); Pin 10 drives the "tip" (left channel).


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r3 - 05 Mar 2016, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email