After spending 2 days experimenting with various hardware configurations and code implementations, and questioning my sanity, I have discovered that using pin A0 does not give me any discernible PWM output variation on my LED, but when I eventually gave up on pin A0 and switched to using pin A7 everything started working as expected.
Since I don't have an oscilloscope (yet) I am unable to do any additional diagnostics, all I can say is that, with exactly the same code, the A0 pin either turns the LED or motor fully on or fully off, yet pin A7 give me the expected PWM variation.
For example, if I use the following code and ramp the value of the 'speed' variable from 0.1 to 0.9 over a few seconds then the LED turns fully on or off at 0.1.
analogWrite(A0,speed, {freq:500});
But if I use the same code on pin A7 then the LED and motor ramp up exactly as expected.
analogWrite(A7,speed, {freq:500});
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.
Okay, time for some feedback.
After spending 2 days experimenting with various hardware configurations and code implementations, and questioning my sanity, I have discovered that using pin A0 does not give me any discernible PWM output variation on my LED, but when I eventually gave up on pin A0 and switched to using pin A7 everything started working as expected.
Since I don't have an oscilloscope (yet) I am unable to do any additional diagnostics, all I can say is that, with exactly the same code, the A0 pin either turns the LED or motor fully on or fully off, yet pin A7 give me the expected PWM variation.
For example, if I use the following code and ramp the value of the 'speed' variable from 0.1 to 0.9 over a few seconds then the LED turns fully on or off at 0.1.
analogWrite(A0,speed, {freq:500});
But if I use the same code on pin A7 then the LED and motor ramp up exactly as expected.
analogWrite(A7,speed, {freq:500});