//--- "Speaker_Start"  Plays a pitch thru a speaker and lights an LED     ---
//
//--- Set up:  > Attach a piezo speaker between ground and Digital 6 
//             > Wire an LED from Digital 7 (pin 13) thru resistor to gnd

int speakerPin = 6;
int LEDpin = 7;

 void setup() {         
   pinMode(speakerPin, OUTPUT);  // Define Speaker pin
   pinMode(LEDpin, OUTPUT);      // Define LED pin   
   }

  void loop() {   
   digitalWrite(LEDpin, HIGH);   // Turn on LED
   for(int i = 0; i < 300; i++)  // number of vibrations (duration)
      {
      digitalWrite(speakerPin, HIGH);   // speaker Pin high
      delayMicroseconds(700);          // delay before releasing speaker
      digitalWrite(speakerPin, LOW);    // speaker Pin low 
      delayMicroseconds(700);
     }                          // end loop for one pitch
   digitalWrite(LEDpin, LOW);   // Turn off LED
   delay(1000);                 // wait 1 sec (1000 milliseconds)
}