Which board are you using? An original Espruino, or a Pico?
The original has a DAC on pins A4 and A5, all other pins have PWM (It looks like you copied the example but changed the pins?). If you don't specify a frequency for analogWrite on the PWM pins it'll use a default frequency which is a few kHz which will produce an audible whine. You could try: analogWrite(A0, 0.5, {freq:30000}); and that might fix it for you?
It's surprising you get out of memory for a 17k file, but do you have much other code in the Espruino as well? IIRC fs.readFile doesn't use memory quite as efficiently as it could, but even so I'd hope it'd would have managed 17k.
Still, hopefully the changes to analogWrite above will help you out with the streaming (which is definitely the best way forward)
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.
Which board are you using? An original Espruino, or a Pico?
The original has a DAC on pins A4 and A5, all other pins have PWM (It looks like you copied the example but changed the pins?). If you don't specify a frequency for analogWrite on the PWM pins it'll use a default frequency which is a few kHz which will produce an audible whine. You could try:
analogWrite(A0, 0.5, {freq:30000});
and that might fix it for you?It's surprising you get out of memory for a 17k file, but do you have much other code in the Espruino as well? IIRC
fs.readFile
doesn't use memory quite as efficiently as it could, but even so I'd hope it'd would have managed 17k.Still, hopefully the changes to
analogWrite
above will help you out with the streaming (which is definitely the best way forward)