Yessss... you are right about the note and that is the thing that bothers me. I wanna know if there is any other pins like 5 and 6 that have weird outputs?
Has anybody tested this with an oscilloscope?
Thanks
Well there is always a possibility of different software libraries you try to include in your sketch trying to utilize the same timers used by analogWrite commands, thereby setting up a conflict with the analogWrite commands. The default arduino sketch startup code only uses timer0 to support the millis() functions so I wouldn't expect any other 'weird outputs' on other pwm pins driven by the other timers, but hey I didn't even know about the possible 'weirdness' for pins 4 and 5.
Anyway here is a code fragment from the analogWrite core function showing that any and all pwm output pins will be forced to a true LOW or HIGH when used with values 0 and 255 respectively:
void analogWrite(uint8_t pin, int val)
{
// We need to make sure the PWM output is enabled for those pins
// that support it, as we turn it off when digitally reading or
// writing with them. Also, make sure the pin is in output mode
// for consistenty with Wiring, which doesn't require a pinMode
// call for the analog output pins.
pinMode(pin, OUTPUT);
if (val == 0)
{
digitalWrite(pin, LOW);
}
else if (val == 255)
{
digitalWrite(pin, HIGH);
}
else
{
switch(digitalPinToTimer(pin))
{
Lefty