diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-08-08 16:43:19 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-08-08 16:43:19 +0200 |
commit | a8193ed933d9c9954cefbfb541cde56770ab5b74 (patch) | |
tree | 80796833fecca5d7426f1d09f7ac9870bab5f062 /libraries/Esplora/Beginners/EsploraMusic | |
parent | a4c9fee673342304a5b12f7f2f7f9ecb9cb26d30 (diff) | |
parent | 5527c44aa443b20d63cf7a276180a36695233924 (diff) |
Merge branch 'ide-1.5.x-library-to-new-format' into ide-1.5.x
Diffstat (limited to 'libraries/Esplora/Beginners/EsploraMusic')
-rw-r--r-- | libraries/Esplora/Beginners/EsploraMusic/EsploraMusic.ino | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/libraries/Esplora/Beginners/EsploraMusic/EsploraMusic.ino b/libraries/Esplora/Beginners/EsploraMusic/EsploraMusic.ino deleted file mode 100644 index 7a950fb..0000000 --- a/libraries/Esplora/Beginners/EsploraMusic/EsploraMusic.ino +++ /dev/null @@ -1,53 +0,0 @@ -/* - Esplora Music - - This sketch turns the Esplora in a simple musical instrument. - Press the Switch 1 and move the slider to see how it works. - - Created on 22 november 2012 - By Enrico Gueli <enrico.gueli@gmail.com> - modified 22 Dec 2012 - by Tom Igoe -*/ - - -#include <Esplora.h> - -// these are the frequencies for the notes from middle C -// to one octave above middle C: -const int note[] = { -262, // C -277, // C# -294, // D -311, // D# -330, // E -349, // F -370, // F# -392, // G -415, // G# -440, // A -466, // A# -494, // B -523 // C next octave -}; - -void setup() { -} - -void loop() { - // read the button labeled SWITCH_DOWN. If it's low, - // then play a note: - if (Esplora.readButton(SWITCH_DOWN) == LOW) { - int slider = Esplora.readSlider(); - - // use map() to map the slider's range to the - // range of notes you have: - byte thisNote = map(slider, 0, 1023, 0, 13); - // play the note corresponding to the slider's position: - Esplora.tone(note[thisNote]); - } - else { - // if the button isn't pressed, turn the note off: - Esplora.noTone(); - } -} |