torstai 7. maaliskuuta 2013

Arduino Tone

I discovered that Arduino can play simple beep sounds without anything special. I ripped the speaker element from old headphones, soldered two wires to it and connected to arduino GND and digital 8 through 100ohm resistor. It played continuous beep sound... was pretty fun.



Found the code from here: http://arduino.cc/en/Tutorial/Tone4

bEEp! bEEp! bEEp! bEEp! bEEp! bEEp!



void setup() {

}

void loop() {
   // turn off tone function for pin 11:
   noTone(11);        
  // play a note on pin 6 for 200 ms:
  tone(8, 440, 200);
  delay(200);

  // turn off tone function for pin 6:
  noTone(8);
delay(300);

}

Ei kommentteja:

Lähetä kommentti