Merge pull request #19 from jjmax75/master

Theme song
pull/21/head
Gordon Williams 2019-11-12 08:34:49 +00:00 committed by GitHub
commit 3194228397
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 0 deletions

View File

@ -361,5 +361,16 @@
{"name":"-blescan","url":"blescan.js"},
{"name":"*blescan","url":"blescan-icon.js", "evaluate":true}
]
},
{ "id": "mmonday",
"name": "Manic Monday Tone",
"icon": "manic-monday-icon.png",
"description": "The Bangles make a comeback",
"tags": "sound",
"storage": [
{"name":"+mmonday","url":"manic-monday.json"},
{"name":"-mmonday","url":"manic-monday.js"},
{"name":"*mmonday","url":"manic-monday-icon.js","evaluate":true}
]
}
]

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("MDABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"))

BIN
apps/manic-monday-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

46
apps/manic-monday.js Normal file
View File

@ -0,0 +1,46 @@
// made using https://www.espruino.com/Making+Music
// Manic Monday tone by The Bangles
var SPEAKER_PIN = D18;
function freq(f) {
if (f===0) digitalWrite(SPEAKER_PIN, 0);
else analogWrite(SPEAKER_PIN, 0.5, {freq: f});
}
freq(1000);
freq(1500);
freq(0);
var pitches = {
'G': 207.65,
'a': 220.00,
'b': 246.94,
'c': 261.63,
'd': 293.66,
'e': 329.63,
'f': 369.99,
'g': 392.00,
'A': 440.00,
'B': 493.88,
'C': 523.25,
'D': 587.33,
'E': 659.26,
'F': 698.46
};
function step() {
var ch = tune[pos];
if (ch !== undefined) pos++;
if (ch in pitches) freq(pitches[ch]);
else freq(0); // off
}
var tune = "aggffefed";
var pos = 0;
setWatch(() => {
var playing = setInterval(step, 500);
if(playing === 0) clearInterval(playing);
}, BTN1);
E.showMessage('BTN1 to start', 'Manic Monday');

5
apps/manic-monday.json Normal file
View File

@ -0,0 +1,5 @@
{
"name":"Manic Monday tone",
"icon": "*mmonday",
"src":"-mmonday"
}