Device::BCM2835::NES - Perl extension for interfacing with a NES controller from the Raspberry Pi's GPIO ports.
# Sample Program (NOTE: MUST RUN VIA SUDO) use Device::BCM2835::NES; use strict; # Instantiate object my $nes = Device::BCM2835::NES->new(); # Add controller at pin 21 $nes->addController(Device::BCM2835::NES::RPI_GPIO_P1_13); # Initialize libraries / GPIO pins $nes->init(); # Read contrller data while(1) { # Get raw data for all controllers my @raw = $nes->read(); # Translate raw data into text (e.g SELECT, START) foreach $c (@raw) { my @btns = $nes->translateButtons($c); print join(' ',@btns); } # Cycle - NES Reads controller data at 60Hz $nes->cycle(); }
Defaults: LATCH - Device::BCM2835::NES::RPI_GPIO_P1_11 CLOCK - Device::BCM2835::NES::RPI_GPIO_P1_12
http://search.cpan.org/~mikem/Device-BCM2835-1.3/lib/Device/BCM2835.pm
Chris Kloberdanz, <klobyone@gmail.com<gt>
Copyright (C) 2012 by Chris Kloberdanz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
To install Device::BCM2835::NES, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::BCM2835::NES
CPAN shell
perl -MCPAN -e shell install Device::BCM2835::NES
For more information on module installation, please visit the detailed CPAN module installation guide.