Changing the PWM phase #1202
Unanswered
coderatchance
asked this question in
Q&A
Replies: 2 comments
-
Does it require dead-time as for when you are driving a H-bridge, or is some overlap at the moment of switching ok? |
Beta Was this translation helpful? Give feedback.
0 replies
-
You could use the CCL for outputting the PWM output of one of the timers to another pin and invert it while doing so. Below example (Attiny412) outputs WO2 on PA2 and then the CCL also outputs that PWM signal inverted on PA6.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello All!
I am trying to run two PWMs sequentially, however, I would like to adjust their phase, namely inverting.
I guess this can be done with the analogWrite()?
Such as analogWrite(brightness, myLedPin);
For example, I took a shot with fading two leds to get the visuals...
However, the whole fading concept does not work...
For one led, namely brightness, it works well, it goes up and down.
While for the brightness2 I can not figure out the "phase adjustment", namely to start latter...
As it can been seen below I have used the simple if().
Brightness starts inphase, while the brightness2 should be 180 degrees out of phase?
For example, when brightness is 0, the brightness2 is 255,
and the opposite, when brightness2 = 255, brightness = 0.
Anyway, here is the code:
Any ideas how to tackle this would be very appreciated !
Best.
PS: would a simple delay() do the trick?
Beta Was this translation helpful? Give feedback.
All reactions