Created
February 2, 2018 18:17
-
-
Save tesseslol/c204e07f6b31abf39acce98c26fccb06 to your computer and use it in GitHub Desktop.
Coooompito per casa di Arduaino per il proff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
const int buzzerPin = 3; | |
const int ledPin1 = 13; | |
int counter = 0; | |
void setup() | |
{ | |
pinMode(buzzerPin, OUTPUT); | |
pinMode(ledPin1, OUTPUT); | |
} | |
void loop() { | |
strofaUno(); | |
strofaDue(); | |
} | |
void beep(int note, int duration) { | |
tone(buzzerPin, note, duration); | |
digitalWrite(ledPin1, HIGH); | |
delay(duration); | |
digitalWrite(ledPin1, LOW); | |
noTone(buzzerPin); | |
delay(50); | |
} | |
void strofaUno(){ | |
delay(2500); // 1 | |
beep(eH, 500); | |
beep(eH, 500); | |
beep(eH, 500); | |
beep(c, 2000); // 2 | |
beep(g, 2000); | |
beep(f, 500); // 3 | |
beep(e, 500); | |
beep(d, 500); | |
beep(cH, 2000); | |
beep(g, 1000); | |
beep(f, 500); // 4 | |
beep(e, 500); | |
beep(d, 500); | |
beep(cH, 2000); | |
beep(g, 1000); | |
beep(f, 500); // 5 | |
beep(e, 500); | |
beep(f, 500); | |
beep(d, 2000); | |
delay(250); | |
beep(eH, 1000); | |
beep(eH, 500); | |
beep(c, 2000); // 6 | |
beep(g, 2000); | |
beep(f, 500); // 7 | |
beep(e, 500); | |
beep(d, 500); | |
beep(cH, 2000); | |
beep(g, 1000); | |
} | |
void strofaDue() { | |
beep(f, 500); // 1 | |
beep(e, 500); | |
beep(d, 500); | |
beep(cH, 2000); | |
beep(g, 1000); | |
beep(f, 500); // 2 | |
beep(e, 500); | |
beep(f, 500); | |
beep(d, 2000); | |
delay(250); | |
beep(eH, 1000); | |
beep(eH, 500); | |
beep(fH, 1500); //3 | |
beep(fH, 500); | |
beep(f, 500); | |
beep(e, 500); | |
beep(d, 500); | |
beep(c, 500); | |
beep(c, 500); // 4 | |
beep(d, 500); | |
beep(e, 500); | |
beep(d, 1000); | |
beep(fH, 500); | |
beep(gH, 1000); | |
beep(eH, 1000); | |
beep(eH, 500); | |
beep(fH, 1500); //* 5 | |
beep(fH, 500); | |
beep(f, 500); | |
beep(e, 500); | |
beep(d, 500); | |
beep(c, 500); | |
beep(g, 1000); //6 | |
beep(d, 2000); | |
delay(500); | |
beep(eH, 500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment