karpiozo 0 Posted September 11, 2017 Share Posted September 11, 2017 I am using Energia 17 environment with LAUNCHXL-F28069M board. I would like to implement PWM signal on two pins. One signal for example with 30% duty cycle and second inverted to the first one. It means when 1st pin is HIGH the 2nd should be LOW and conversely. In arduino language is only one function for PWM "analogWrite(80,100)". How to set inverted PWM signal in the same phase on second pin? Quote Link to post Share on other sites
Ekrem 5 Posted February 21, 2018 Share Posted February 21, 2018 On 9/11/2017 at 12:56 PM, karpiozo said: I am using Energia 17 environment with LAUNCHXL-F28069M board. I would like to implement PWM signal on two pins. One signal for example with 30% duty cycle and second inverted to the first one. It means when 1st pin is HIGH the 2nd should be LOW and conversely. In arduino language is only one function for PWM "analogWrite(80,100)". How to set inverted PWM signal in the same phase on second pin? I think the command below would work: pin_2_state = !digitalRead(pin_1); digitalWrite(pin_2, pin_2_state); Keep in mind that this doesn't add dead-time between pin 1 and pin 2 though. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.