pwm

from two pwm pins i pulled out 25% and 50% duty cycle ,joined both the pins and measured i got average of both duty cycle why is that?????

Duty cycle is a the percentage that the signal is high vs low during one period.

For instance, if your period is 4 seconds. If one pin is high for the first second and low the last 3, it has a 25% duty cycle. If one pin is high for the first two seconds and low the last 2, it has a 50% duty cycle.

If you connect the pins together WHICH YOU SHOULD NEVER DO!! (you can short it out when the second pin goes high and the first goes low and it backfeeds the first pin) you will get floating signals and its anyone's guess what duty cycle you should get.

I'm just an electrical engineering student, not 100%, but we learned about this today in my micro-controller class. I would assume the arduino would have a buffer that when you try to short it, it just does a voltage division and you end up with floating signals.

do check the image

i guess i got about the effect on arduino but what is the reason in change in dutycycle

stuck with a concept.png

How are you measuring this? A scope is the only real way to see what is happening. How are the two outputs wired together? If just connected then you have already damaged your arduino.

i mentioned using pulseIn ...

would assume the arduino would have a buffer that when you try to short it, it just does a voltage division and you end up with floating signals.

"Assume" all you like, but there are datasheets for when you have to come back to reality.

i mentioned using pulseIn ...

Assuming you mean measured, that will not tell you much because it depends on the voltage threshold of a digital input. You have two outputs one high and the other low so who knows what voltage results. As AWOL said, connecting two outputs together is a good way of destroying your arduino. In fact it is way number 2 in this link:- http://ruggedcircuits.com/html/ancp01.html

If you OR the two through diodes then no harm can result. The output will be equal to the longer of the two.

pin_x -----A_K--
                |----- out                    
pin_y -----A_K--

When running that back to a pulse-in pin (input), do so through a resistor, 220-1000?.

The output will be equal to the longer of the two.

Thinking about this, I'm going to walk that back a bit.

That result would be valid [u]only[/u] when (if) their rising-edges coincide.

digitalWrite (pin_x,127);
delay (1);
digitalWrite (pin_y,127);

would probably end up looking like 100% duty at the OR'ing diodes' output.

That result would be valid only when (if) their rising-edges coincide.

They will if the two pins are run off the same timer, like pins 3 and 11.