Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
project:arduino-kickstarter-tetris [19.11.2011 12:45] – angelegt q-rai | project:arduino-kickstarter-tetris [14.01.2013 15:56] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Tetrismelodie ====== | ====== Tetrismelodie ====== | ||
+ | Die Tetrismelodie besteht aus drei Tonspuren: Sopran, Alt und Bass. Diese sind im Programm als einzelne Melodien gespeichert. Mit mehreren Arduinos kannst du alle drei gleichzeitig abspielen. | ||
+ | |||
==== Sopran ==== | ==== Sopran ==== | ||
+ | Der Sopran ist die Hauptmelodie, | ||
Aufruf: '' | Aufruf: '' | ||
< | < | ||
Zeile 33: | Zeile 36: | ||
==== Alt ==== | ==== Alt ==== | ||
- | Aufruf: playMelody( melodyTrack2, | + | Aufruf: |
< | < | ||
int melodyTrack2[] = { | int melodyTrack2[] = { | ||
Zeile 62: | Zeile 65: | ||
</ | </ | ||
+ | ==== Bass ==== | ||
Aufruf: '' | Aufruf: '' | ||
< | < | ||
Zeile 98: | Zeile 102: | ||
===== Programm ===== | ===== Programm ===== | ||
+ | Das Basisprogramm hat -- wie immer -- eine Setup- und eine Loop-Funktion | ||
< | < | ||
- | void loop() | + | void setup() |
{ | { | ||
- | //playMelody( melodyTrack3, durationsTrack3, | + | // put your setup code here, to run once: |
- | //playMelody( melodyTrack2, | + | pinMode( 8, OUTPUT |
+ | } | ||
+ | |||
+ | // loop spielt hier die Hauptmelodie | ||
+ | void loop() | ||
+ | { | ||
playMelody( melodyTrack1, | playMelody( melodyTrack1, | ||
} | } | ||
Zeile 128: | Zeile 138: | ||
} | } | ||
} | } | ||
+ | </ | ||
+ | |||
+ | ===== Tonbibliothek ===== | ||
+ | Die Tonbibliothek heisst pitches.h und kann analog zum Beispiel Digital -> toneMusic eingebunden werden. | ||
+ | < | ||
+ | / | ||
+ | * Public Constants | ||
+ | | ||
+ | |||
+ | #define NOTE_H0 | ||
+ | #define NOTE_C1 | ||
+ | #define NOTE_CS1 35 | ||
+ | #define NOTE_D1 | ||
+ | #define NOTE_DS1 39 | ||
+ | #define NOTE_E1 | ||
+ | #define NOTE_F1 | ||
+ | #define NOTE_FS1 46 | ||
+ | #define NOTE_G1 | ||
+ | #define NOTE_GS1 52 | ||
+ | #define NOTE_A1 | ||
+ | #define NOTE_AS1 58 | ||
+ | #define NOTE_H1 | ||
+ | #define NOTE_C2 | ||
+ | #define NOTE_CS2 69 | ||
+ | #define NOTE_D2 | ||
+ | #define NOTE_DS2 78 | ||
+ | #define NOTE_E2 | ||
+ | #define NOTE_F2 | ||
+ | #define NOTE_FS2 93 | ||
+ | #define NOTE_G2 | ||
+ | #define NOTE_GS2 104 | ||
+ | #define NOTE_A2 | ||
+ | #define NOTE_AS2 117 | ||
+ | #define NOTE_H2 | ||
+ | #define NOTE_C3 | ||
+ | #define NOTE_CS3 139 | ||
+ | #define NOTE_D3 | ||
+ | #define NOTE_DS3 156 | ||
+ | #define NOTE_E3 | ||
+ | #define NOTE_F3 | ||
+ | #define NOTE_FS3 185 | ||
+ | #define NOTE_G3 | ||
+ | #define NOTE_GS3 208 | ||
+ | #define NOTE_A3 | ||
+ | #define NOTE_AS3 233 | ||
+ | #define NOTE_H3 | ||
+ | #define NOTE_C4 | ||
+ | #define NOTE_CS4 277 | ||
+ | #define NOTE_D4 | ||
+ | #define NOTE_DS4 311 | ||
+ | #define NOTE_E4 | ||
+ | #define NOTE_F4 | ||
+ | #define NOTE_FS4 370 | ||
+ | #define NOTE_G4 | ||
+ | #define NOTE_GS4 415 | ||
+ | #define NOTE_A4 | ||
+ | #define NOTE_AS4 466 | ||
+ | #define NOTE_H4 | ||
+ | #define NOTE_C5 | ||
+ | #define NOTE_CS5 554 | ||
+ | #define NOTE_D5 | ||
+ | #define NOTE_DS5 622 | ||
+ | #define NOTE_E5 | ||
+ | #define NOTE_F5 | ||
+ | #define NOTE_FS5 740 | ||
+ | #define NOTE_G5 | ||
+ | #define NOTE_GS5 831 | ||
+ | #define NOTE_A5 | ||
+ | #define NOTE_AS5 932 | ||
+ | #define NOTE_H5 | ||
+ | #define NOTE_C6 | ||
+ | #define NOTE_CS6 1109 | ||
+ | #define NOTE_D6 | ||
+ | #define NOTE_DS6 1245 | ||
+ | #define NOTE_E6 | ||
+ | #define NOTE_F6 | ||
+ | #define NOTE_FS6 1480 | ||
+ | #define NOTE_G6 | ||
+ | #define NOTE_GS6 1661 | ||
+ | #define NOTE_A6 | ||
+ | #define NOTE_AS6 1865 | ||
+ | #define NOTE_H6 | ||
+ | #define NOTE_C7 | ||
+ | #define NOTE_CS7 2217 | ||
+ | #define NOTE_D7 | ||
+ | #define NOTE_DS7 2489 | ||
+ | #define NOTE_E7 | ||
+ | #define NOTE_F7 | ||
+ | #define NOTE_FS7 2960 | ||
+ | #define NOTE_G7 | ||
+ | #define NOTE_GS7 3322 | ||
+ | #define NOTE_A7 | ||
+ | #define NOTE_AS7 3729 | ||
+ | #define NOTE_H7 | ||
+ | #define NOTE_C8 | ||
+ | #define NOTE_CS8 4435 | ||
+ | #define NOTE_D8 | ||
+ | #define NOTE_DS8 4978 | ||
</ | </ |