mattg31
Posts: 79
Joined: Fri Jan 05, 2018 9:55 pm

Concerns with using pigpio

Wed Jan 24, 2018 1:25 pm

Hello,
I have written a GUI for my program using tkinter, and will be using this program to interact with the GPIO pins (buttons turning on/off LED's). After doing some research I have found that the solution to this is using the pigpio library.

I am new to programming, so to me this seems like a "workaround".
Is this the accepted method of being able to interact with GPIO pins using buttons on a GUI application? Why can't we just tell the raspberry pi that the application has sudo privileges somehow?

Any info would be helpful!

Thanks!

Matt

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6229
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Concerns with using pigpio

Wed Jan 24, 2018 1:38 pm

mattg31 wrote: Is this the accepted method of being able to interact with GPIO pins using buttons on a GUI application?
There is no one true method, but pigpio is a perfectly valid one. There's also wiringpi, the sysfs interface and many others. There are advantages and disadvantages for each method, but for your use case, it shouldn't matter which you use.
mattg31 wrote: Why can't we just tell the raspberry pi that the application has sudo privileges somehow?
You can, but the idea is to compartmentalise things and not give more access than an application requires. Running the whole thing as root is not a good solution.
https://en.wikipedia.org/wiki/Setuid

mattg31
Posts: 79
Joined: Fri Jan 05, 2018 9:55 pm

Re: Concerns with using pigpio

Thu Jan 25, 2018 10:28 am

ok, thanks for the reply @ShiftPlusOne !

User avatar
bensimmo
Posts: 4623
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Concerns with using pigpio

Thu Jan 25, 2018 10:44 am

mattg31 wrote:
Thu Jan 25, 2018 10:28 am
ok, thanks for the reply @ShiftPlusOne !
When I started on the Pi, it was nice not to have to use sudo to run a program just to access them.

One advantage pigpio (well pigpiod) does give you is you can run the GUI on something else other than the Pi. No idea if that is true for the other methods.

mattg31
Posts: 79
Joined: Fri Jan 05, 2018 9:55 pm

Re: Concerns with using pigpio

Sun Jan 28, 2018 2:30 pm

One advantage pigpio (well pigpiod) does give you is you can run the GUI on something else other than the Pi. No idea if that is true for the other methods.
Oh cool! good to know, thanks!

Return to “Beginners”