Hi Paul,
I would like to use two PWM outputs with different frequencies.
Me too! Unfortunately, a hardware limitation means the period setting is shared by all the PwmOut outputs (the pulsewidth can be changed independently however). I've fed this back to NXP, so they are aware of the constraint this places.
I've also added an implementation note to http://mbed.org/handbook/PwmOut
The pwm is still quite useful for brightness, speed and position control, but just be aware of this limitation for the frequency to be the same for all of them.
It may be worth building a "software pwm", but these will generally suffer from jitter. I assume the speeds you show in your example (seconds) were more for demonstration than a real application?
Simon
Hi,
I would like to use two PWM outputs with different frequencies. I tried the code below.
I expected to see two LED flashing in two different frequencies, but the result showed LED1 always on and LED2 flashing with the period of 2 seconds.
Any comment?
Best regards,
Paul