// TD-ARDUINO // test du buzzer const int c = 261; const int d = 294; const int e = 329; const int f = 349; const int g = 391; const int gS = 415; const int a = 440; const int aS = 455; const int b = 466; const int cH = 523; const int cSH = 554; const int dH = 587; const int dSH = 622; const int eH = 659; const int fH = 698; const int fSH = 740; const int gH = 784; const int gSH = 830; const int aH = 880; int counter = 0; #define buzzerPin 1 void setup() { pinMode(buzzerPin, OUTPUT); Serial.begin(9600); } void loop() { play_jingle(); delay(3000); } void play_jingle() { beep(a, 500); beep(a, 500); beep(a, 500); beep(f, 350); beep(cH, 150); beep(a, 500); beep(f, 350); beep(cH, 150); beep(a, 650); delay(500); beep(eH, 500); beep(eH, 500); beep(eH, 500); beep(fH, 350); beep(cH, 150); beep(gS, 500); beep(f, 350); beep(cH, 150); beep(a, 650); delay(500); } void beep(int note, int duration) { //Play tone on buzzerPin tone(buzzerPin, note, duration); //Stop tone on buzzerPin noTone(buzzerPin); delay(50); //Increment counter counter++; }