davidlaw1234
Posts: 2
Joined: Mon Oct 02, 2017 9:13 pm

Inverted PWM pigpio

Wed Oct 11, 2017 9:58 pm

Hi,

Hardware = Raspberry pi 3 B v1.2

Software =

#include<stdio.h>
#include<pigpio.h>


int main(void)
{

if (gpioInitialise()<0) return 1;
gpioSetMode(23,PI_OUTPUT);
gpioWrite(23,1);
gpioSetPWMfrequency(27,40000);
gpioSetPWMfrequency(22,40000);
gpioPWM(22,255);
gpioPWM(27,255);

}

At this point all I am trying to do is output TWO pwm signals using the pigpio library and gcc comilier.
based on the the spec L298

http://www.st.com/content/ccc/resource/ ... 000240.pdf

I need two opposing TTL signals in order to run a DC motor. As one is high the other is low.

The above code gives two identical pwm outputs on gpio22 and gpio27. I am using gpio23 as my ENABLE.

Instead of using a hardware inverter for the second pwm,

Is there a way for me to invert the second pwm (gpio27) using the pigpio library so that is in an inverted state as compared to gpio22?

Dave

Return to “C/C++”

Who is online

Users browsing this forum: FeroxCannibal, PhilE and 10 guests