Thanks for your testing, I haven't anything I could call an oscilloscope and did my peasurment with my multimeter.
I just dove into the beta6 source code and I think I found the culprit
pins_teensy.c has void analogWrite(uint8_t pin, int val) on line 492 wich starts like this :
Code:
void analogWrite(uint8_t pin, int val)
{
uint32_t cval;
pinMode(pin, OUTPUT);
if (val <= 0) {
digitalWrite(pin, LOW);
pinMode(pin, OUTPUT); // TODO: implement OUTPUT_LOW
return;
} else if (val > 255) {
digitalWrite(pin, HIGH);
pinMode(pin, OUTPUT); // TODO: implement OUTPUT_HIGH
return;
}
The arduino counter parts sits in wiring_analog.c line 100 as void analogWrite(uint8_t pin, int val) :
Code:
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);
}
There's a clear difference here. To be ardnuino's equivalent
} else if (val > 255) {
should at least be replaced by
} else if (val >= 255) {
Then there is the problem I talked about
here, but I'm not sure it applies in this case.