Hi ,
I am using pwm outputs 9,10 & 11.
pin 11 works perfect but pin 9 & 10 only works when i set duty to 255.
for example
analogWrite(9,255);
analogWrite(10,255);
analogWrite(11,255);
this command set output pin 9, 10 & 11 to full.
If i change duty to 127
analogWrite(9,127);
analogWrite(10,127);
analogWrite(11,127);
this command should set output to near 2.5V
but pin 9 & 10 are at 0V & pin 11 is near 2.45V
pin 9 & Pin10 analogwrite function is not working in my code.
I am also using TimerOne to create interrupt.
Is analogWrite function use TimerOne ?
Some one have any idea ?
Thanks
BharatSun:
I am also using TimerOne to create interrupt.
Is analogWrite function use TimerOne ?
Correct!
PWM need a timer to do it's thing. 9 & 10 are the ones on timer1.
http://playground.arduino.cc/Main/TimerPWMCheatsheet
BharatSun:
this command should set output to near 2.5V
No, it will set the voltage to 0 half the time and 5V half the time. The voltage on that pin will not ever be 2.5
system
January 11, 2017, 11:30am
4
The voltage on that pin will not ever be 2.5
How will it get from 0 to 5 without being at 2.5 at some point between the two limits? How will it get from 5 to 0 without being at 2.5 at some point between the two limits? 8)
Delta_G
January 11, 2017, 12:41pm
5
Ok. But it will be very very very brief.
MarkT
January 11, 2017, 1:08pm
6
Delta_G:
Ok. But it will be very very very brief.
For a human, but feel like eons for an electron!
I change my pwm pin to 5 & 6.
Now works perfect.
Thanks
MarkT:
For a human, but feel like eons for an electron!
What's the rise time on a PWM signal at 50% duty? It can't be more than picoseconds.
Still, my point is that you're not ever going to MEASURE 2.5V with any normal measuring device.
system
January 12, 2017, 11:31am
9
Still, my point is that you're not ever going to MEASURE 2.5V with any normal measuring device.
You mean that an oscilloscope is not a normal measuring device? Stop digging. Your hole is deep enough. 8)
Looks pretty quick to me.