How to do deadtime pwm in lua #90
Answered
by
MarivelSwickheimer6pv
jokokiswan
asked this question in
Q&A
-
I just wonder how to drive transistor using deadtime pwm in luat, thank you. |
Beta Was this translation helpful? Give feedback.
Answered by
MarivelSwickheimer6pv
Mar 13, 2023
Replies: 2 comments 2 replies
-
not support yet |
Beta Was this translation helpful? Give feedback.
1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jokokiswan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To drive a transistor using deadtime PWM in Lua, you can use a combination of timers and GPIO pins. Here's an example code snippet:
lua
In this example, channel1 and channel2 are the GPIO pins connected to the transistor. frequency is the PWM frequency, dutyCycle1 is the duty cycle for channel1, and dutyCycle2 is the duty cycle for channel2.
The tmr.alarm function sets up a timer that will start channel2 after a specified deadTime. This ensures that there is a delay between turning off channel1 and turning on channel2, which is necessary to prevent a short circuit.
I hope this helps! Let me know if you have any further questions.