With a very simple connection of an LED (which can withstand 5V) to ground and to a pin on my Galileo gen2, I can never output a non-zero voltage from the pin via analogWrite
, regardless of whether the pin is digital or analog (although PWM digital works)
The LED is in the correct bias and I'm calling pinMode(pin, OUTPUT)
before attempting to call analogWrite(pin, 255)
(or any 2nd parameter in-between), even though it's not even necessary.
The LED glows if I call digitalWrite(pin, HIGH)
on both analog and digital pins, but does not glow at all for analogWrite(pin, 255)
with the same configuration and pins, nor does it for any 2nd param in [0, 255]. This holds for whether the call is attempted in loop()
or setup()
.
The only possible way I can get the LED to receive any power from analogWrite
is through a digital PWM pin, but I know the other digital pins can still produce square-waves with timers and the analog pins should certainly be able to use PWM.
(So far, I've been to scared of short-circuits to connect the analogWrite output straight into an analog input to read the voltage)
Is there something I don't understand about the underlying board, or am I experiencing some strange malfunction?
Thanks,
Tyson
analogWrite
doesn't make the necessary use of timers to simulate a square-wave, unlike the functiontone
. But why wouldn't analog pins write analog?!analogWrite
as binarydigitalWrite
s, thresholding past 255/2 (slightly different to always being 0 on my Galileo)