YoshiFan100
Posts: 32
Joined: Fri Nov 29, 2019 9:37 pm

Perl Controlling Gpio

Sat Jan 04, 2020 9:13 pm

I am interested in learning Perl, and wonder how to control the raspberry pi 4s gpio pins with perl, such as blinking an led. I was wondering if there is a library or something similar that I could use for perl. Thanks!


YoshiFan100
Posts: 32
Joined: Fri Nov 29, 2019 9:37 pm

Re: Perl Controlling Gpio

Sat Jan 04, 2020 9:40 pm

I used the first link, and I downloaded like how the instructions said. However when I try to run the perl file in geany ide, I get the following error message.

Code: Select all

 Can't locate Device/BCM2835.pm in @INC (you may need to install the Device::BCM2835 
How do I solve this error message? Thanks!

User avatar
joan
Posts: 14681
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Perl Controlling Gpio

Sat Jan 04, 2020 10:00 pm

I have no idea, I don't use those PERL modules.

User avatar
scruss
Posts: 2822
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Perl Controlling Gpio

Sat Jan 04, 2020 11:22 pm

You need to install the support library first from the BCM 2835 support page.
Then you'd install the module with

Code: Select all

sudo cpan Device::BCM2835
It seems a little old, so may not work on newer Raspberry Pis.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

YoshiFan100
Posts: 32
Joined: Fri Nov 29, 2019 9:37 pm

Re: Perl Controlling Gpio

Sun Jan 05, 2020 2:25 am

It does seem old. It did not work. Seems like a lot of the GPIO libraries only work on older pis. I will try to find a different library.

User avatar
DougieLawson
Posts: 37092
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Perl Controlling Gpio

Sun Jan 05, 2020 8:00 am

YoshiFan100 wrote:
Sun Jan 05, 2020 2:25 am
It does seem old. It did not work. Seems like a lot of the GPIO libraries only work on older pis. I will try to find a different library.
I suspect you will need to sharpen your coding pencil. There's very few folks who've ever twiddled GPIOs with Perl.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

jahboater
Posts: 5046
Joined: Wed Feb 04, 2015 6:38 pm

Re: Perl Controlling Gpio

Sun Jan 05, 2020 8:27 am

Or consider a more common choice for GPIO access such as Python or C.

User avatar
joan
Posts: 14681
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Perl Controlling Gpio

Sun Jan 05, 2020 10:11 am

The one which uses my pigpio daemon seems to work. It certainly toggles a GPIO.

https://metacpan.org/pod/RPi::PIGPIO

User avatar
scruss
Posts: 2822
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Perl Controlling Gpio

Sun Jan 05, 2020 3:29 pm

jahboater wrote:
Sun Jan 05, 2020 8:27 am
Or consider a more common choice for GPIO access such as Python or C.
Yeah, but none of them are Perl. It's still the language that gives me the most delight to use.

Even the RPi::PIGPIO library looks a little under-maintained, but I'm glad it works.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “Other programming languages”