Hi,
Playing around with AnalogWrite and my scope:
This little script toggles between two duty cycles:
const int analogOutPin = 9;
void setup() {
pinMode (analogOutPin,OUTPUT);
}
void loop() {
analogWrite(analogOutPin, 100);
delay(15);
analogWrite(analogOutPin, 150);
delay(15);
}
below is how this looks on the scope, blue direct, yellow with a simple
R-C lowpass.
every now and then, when changing duty cycle, I get an extra-long pulse.
I am using the G2553 on the launchpad, with xtal.
I have seen on this forum that calling AnalogWrite when NOT changing the duty cycle should be avoided.
But I DO sometimes want to change the duty cycle ;-)
Tried the same on an Arduino Uno, no problem there, smooth transitions.
any suggestions?
maelli01