Skip to content

Instantly share code, notes, and snippets.

@hsiboy
Last active August 29, 2015 13:57
Show Gist options
  • Save hsiboy/9395789 to your computer and use it in GitHub Desktop.
Save hsiboy/9395789 to your computer and use it in GitHub Desktop.
Raspberry Pi - BCM2835 - Getting to blinky - Perl
#!/usr/bin/env perl
# need to run as root.
# flashes an led connected to GPIO 11 aka PIN 17
use strict;
use warnings;
use Device::BCM2835;
Device::BCM2835::init() || die "Could not init library";
Device::BCM2835::gpio_fsel( &Device::BCM2835::RPI_GPIO_P1_11,
&Device::BCM2835::BCM2835_GPIO_FSEL_OUTP);
while( 1 ){
Device::BCM2835::gpio_write(&Device::BCM2835::RPI_GPIO_P1_11, 1);
Device::BCM2835::delay(500);
Device::BCM2835::gpio_write(&Device::BCM2835::RPI_GPIO_P1_11, 0);
Device::BCM2835::delay(500);
}
exit( 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment