Can someone talk me through getting GPIO working under perl please.
I need to flash some LED's
Thanks in advance
Andrew
Re: Need a hand please : Perl GPIO
Thank you I will try this tomorrow
I will leave it logging over night
I will leave it logging over night
Re: Need a hand please : Perl GPIO
I was looking at the PERL examples.
How do I "get and install" the bcm2835 library
How do I "get and install" the Device::BCM2835 perl library ?
Is CPAN involved ? APT-GET ?
Andrew
How do I "get and install" the bcm2835 library
How do I "get and install" the Device::BCM2835 perl library ?
Is CPAN involved ? APT-GET ?
Andrew
Re: Need a hand please : Perl GPIO
joan wrote:Have you tried http://elinux.org/RPi_GPIO_Code_Samples#Perl ?
Can you help me ??
I need to read a pin of raspberry pi, and when the pin is close to the ground, i want to count the time, and the pin is not close i want to stop the counting... and then i want to send to network a file with that time...
Re: Need a hand please : Perl GPIO
like this?
viewtopic.php?f=32&t=146793&p=966533#p966533
where is your code?
what problem are you getting?
you won't get your homeworks made.
at least not by me
viewtopic.php?f=32&t=146793&p=966533#p966533
where is your code?
what problem are you getting?
you won't get your homeworks made.
at least not by me
Re: Need a hand please : Perl GPIO
Anyone able to flash an led using perl ?
Re: Need a hand please : Perl GPIO
vk4tec,
But only because I think it's a crazy idea.
People flash LEDs on the Pi all the time from C/C++, Python, C#, Java, Javascript. Why on Earth do you want to do it from Perl?
I know that is not very helpful. But horses for courses and all that.
No.Anyone able to flash an led using perl ?
But only because I think it's a crazy idea.
People flash LEDs on the Pi all the time from C/C++, Python, C#, Java, Javascript. Why on Earth do you want to do it from Perl?
I know that is not very helpful. But horses for courses and all that.
Slava Ukrayini.
Re: Need a hand please : Perl GPIO
easy way to access gpio from every language: write something ask pigpiod to do that for you.Heater wrote:vk4tec,No.Anyone able to flash an led using perl ?
But only because I think it's a crazy idea.
People flash LEDs on the Pi all the time from C/C++, Python, C#, Java, Javascript. Why on Earth do you want to do it from Perl?
I know that is not very helpful. But horses for courses and all that.
flashing a led from php took something like 10 minutes to connect to pigpio and get the led lit..
Re: Need a hand please : Perl GPIO
Heater wrote: ↑Wed May 18, 2016 3:46 pmvk4tec,No.Anyone able to flash an led using perl ?
But only because I think it's a crazy idea.
People flash LEDs on the Pi all the time from C/C++, Python, C#, Java, Javascript. Why on Earth do you want to do it from Perl?
I know that is not very helpful. But horses for courses and all that.
Please do not deprecate other languages. Setting fire to people because they seek a solution in "language X" defeats the whole purpose of learning.
To answer the original question, the package is in fact from CPAN:
http://search.cpan.org/~mikem/Device-BC ... BCM2835.pm
To the OP: If you wish to conform to the masses, then learn how this works in Perl, then look at Python examples, and perform differential analysis to see how Perl and Python differ. Otherwise, use the language you are comfortable with and do not be deterred by the loud and misguided adherents to single language philosophy.
-
- Posts: 1
- Joined: Wed Aug 07, 2019 12:51 pm
Re: Need a hand please : Perl GPIO
Got it to work in Perl on Rasbian buster lite:
It took some additional download / copile / installs
Get latest version of bcm2835 lib:
get the wiringpi lib using apt-get
now get the perl lib for these libs and the RPi::Pin using cpan
All done
Use some example code like this :
It took some additional download / copile / installs
Get latest version of bcm2835 lib:
Code: Select all
wget http://www.open.com.au/mikem/bcm2835/bcm2835-1.59.tar.gz
tar xvfz bcm2835-1.59.tar.gz
cd bcm2835-1.59/
./configure
make
sudo make install
Code: Select all
sudo apt-get install wiringpi
Code: Select all
sudo cpan -i Device::BCM2835
sudo cpan -i WiringPi::API
sudo cpan -i RPi::Pin
Use some example code like this :
Code: Select all
use RPi::Pin;
use RPi::Const qw(:all);
my $pin = RPi::Pin->new(4);
$pin->mode(INPUT);
$pin->write(LOW);
$pin->set_interrupt(EDGE_RISING, ‘main::pin4_interrupt_handler’);
while (1) {
my $num = $pin->num;
my $mode = $pin->mode;
my $state = $pin->read;
print “pin number $num is in mode $mode with state $state\n”;
sleep(1);
}
sub pin4_interrupt_handler {
print “in interrupt handler\n”;
}