Greetings,
Thanks to all who post helpful things! Thanks also for the kick ass Pi hardware! <3
Question: Which library is best to simply change one gpio pin to Output, blink an led, then change pin back?
Best is defined as simple to implement, with a knock-on requirement that others are using it in C with success.
I see a few different possibilities for a C library to access GPIO functions on the Pi (mine = Pi4b).
I do not want to break my currently-working C code on the Pi, it reads ttl input (chars) from an Ardu Mega, and works great. I'm using GPIO pins 14 & 15 on the Pi. I can and will post code, if is is seen as useful to choosing a gpio lib.. Code is nothing exotic, uses typical #includes that were already present in my default Pi OS install.
I've tried pigpio.h and kept bumping into error gpioWrite: pigpio uninitialised, call gpioInitialise()
after I had called the init function and got no error back, and then later tried to change the state of the pin, and get the error. I'm 100% sure the errors are due to my mis-use of the library and not something wrong with it. I just don't want to troubleshoot this one anymore, but I could change my mind..
After exposing more of my ignorance and geting nowhere, I read about Wiringpi.h. I did not try this one due to confusion on which version fit my setup best.
Somewhat defeated, I just made a system() call in my C code to 'pinctrl' to blink the led. It works, and didn't break my C code. But it feels dumb, like, isn't there a lib I *can* use? Any suggestions are gratefully accepted.
Thanks to all who post helpful things! Thanks also for the kick ass Pi hardware! <3
Question: Which library is best to simply change one gpio pin to Output, blink an led, then change pin back?
Best is defined as simple to implement, with a knock-on requirement that others are using it in C with success.
I see a few different possibilities for a C library to access GPIO functions on the Pi (mine = Pi4b).
I do not want to break my currently-working C code on the Pi, it reads ttl input (chars) from an Ardu Mega, and works great. I'm using GPIO pins 14 & 15 on the Pi. I can and will post code, if is is seen as useful to choosing a gpio lib.. Code is nothing exotic, uses typical #includes that were already present in my default Pi OS install.
I've tried pigpio.h and kept bumping into error gpioWrite: pigpio uninitialised, call gpioInitialise()
after I had called the init function and got no error back, and then later tried to change the state of the pin, and get the error. I'm 100% sure the errors are due to my mis-use of the library and not something wrong with it. I just don't want to troubleshoot this one anymore, but I could change my mind..
After exposing more of my ignorance and geting nowhere, I read about Wiringpi.h. I did not try this one due to confusion on which version fit my setup best.
Somewhat defeated, I just made a system() call in my C code to 'pinctrl' to blink the led. It works, and didn't break my C code. But it feels dumb, like, isn't there a lib I *can* use? Any suggestions are gratefully accepted.
Statistics: Posted by axman — Sat Jul 19, 2025 8:32 pm