Thank you.
I’ve taken the advice and written the following for the core (using info from this blog).
The switch is on D3 and is debounced - publishing to “sound1”
int last;
bool ready;
void setup() {
pinMode(D3, INPUT);
last = millis();
ready = true;
}
void loop() {
if (millis() - last > 200) {
if (digitalRead(D3)) {
// button pressed
if (ready) {
ready = false;
Spark.publish("sound1");
last = millis();
}
} else {
// button released
ready = true;
}
}
}
Where I get lost in on the HTML/Javascript side, especially how to cause the mp3 to play.
For instance am I on the right track on modifying this post. I’m so sorry I wasn’t sure how to integrate your above “spark/sparkjs/blob/master/examples/node/get-event-stream-forever.js” link to my HTML code.