Minor thing, but to turn the speaker off you could use digitalRead(C8); instead - that'll put the pin back into an 'input' mode - so if for instance you'd connected the speaker between C8 and VCC then it would ensure that it was actually turned off.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Great! glad you got it sorted!
Minor thing, but to turn the speaker off you could use
digitalRead(C8);
instead - that'll put the pin back into an 'input' mode - so if for instance you'd connected the speaker between C8 and VCC then it would ensure that it was actually turned off.