luni
Well-known member
I noticed that analogWrite(255) does not generate a solid HIGH signal but generates a PWM with a duty cycle of some 99.6%. (this corresponds to 1-1/255).
Here a screen shot of the output (Teensy 3.1, current Teensyduino):
Is this expected behavior or is it a bug? At least it might lead to confusion (see: (https://www.arduino.cc/en/Tutorial/PWM). BTW: analogWrite(0) works as expected (generating a solid LOW)
Code:
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
analogWriteFrequency(3, 5000);
analogWriteFrequency(4, 5000);
analogWrite(4, 50);
analogWrite(3, 255);
Here a screen shot of the output (Teensy 3.1, current Teensyduino):
Is this expected behavior or is it a bug? At least it might lead to confusion (see: (https://www.arduino.cc/en/Tutorial/PWM). BTW: analogWrite(0) works as expected (generating a solid LOW)