Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Скетч для проигрывания имперского марша на пищалке от древнего компа
- Частоты и ноты скопипизжены отсюда:
- http://wiki.tiprocessors.com/index.php/Playing_The_Imperial_March
- */
- const int speakerPin = 4; // Пищалка подключена к этому цифровому пину (для изменения пина нужно изменить еще пару записей внизу)
- // Частоты нот
- 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;
- void beep(int ton, int time)
- {
- tone(4, ton, time); //тут цифра пина
- delay(time + 20);
- }
- void setup()
- {
- noTone(4); //и тут тоже
- }
- void loop()
- {
- 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(250);
- //Конец 1 части
- 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(250);
- //Конец второй части
- beep(aH, 500);
- beep(a, 300);
- beep(a, 150);
- beep(aH, 400);
- beep(gSH, 200);
- beep(gH, 200);
- beep(fSH, 125);
- beep(fH, 125);
- beep(fSH, 250);
- delay(250);
- beep(aS, 250);
- beep(dSH, 400);
- beep(dH, 200);
- beep(cSH, 200);
- beep(cH, 125);
- beep(b, 125);
- beep(cH, 250);
- delay(250);
- beep(f, 125);
- beep(gS, 500);
- beep(f, 375);
- beep(a, 125);
- beep(cH, 500);
- beep(a, 375);
- beep(cH, 125);
- beep(eH, 650);
- //конец третьей части (звучит херовенько, надо бы подправить, но мне влом)
- beep(aH, 500);
- beep(a, 300);
- beep(a, 150);
- beep(aH, 400);
- beep(gSH, 200);
- beep(gH, 200);
- beep(fSH, 125);
- beep(fH, 125);
- beep(fSH, 250);
- delay(250);
- beep(aS, 250);
- beep(dSH, 400);
- beep(dH, 200);
- beep(cSH, 200);
- beep(cH, 125);
- beep(b, 125);
- beep(cH, 250);
- delay(250);
- beep(f, 250);
- beep(gS, 500);
- beep(f, 375);
- beep(cH, 125);
- beep(a, 500);
- beep(f, 375);
- beep(cH, 125);
- beep(a, 650);
- //усьо, зэ энд
- noTone(4); //и даже тут
- delay(10000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement