Timm Murray

NAME

  Device::PCDuino - Control the pcDuino with Perl

SYNOPSIS

  use Device::PCDuino;
  set_input( 0 );
  set_output( 1 );

  # Mirror the input from pin 0 to pin 1 );
  my $input = input( 0 );
  output( 1, $input );

  # Show value of ADC pin 0
  say input_adc( 0 )

DESCRIPTION

Hardware interface for the pcDuino. Gives access to GPIO and ADC pins.

All functions documented below are exported by default

Before using, be sure to load the kernel modules.

  # modprobe gpio
  # modprobe adc
  # modprobe pwm

FUNCTIONS

set_input( PIN_NUMBER )

Set the given pin as an input pin.

set_output( PIN_NUMBER )

Set the given pin as an output pin.

input( PIN_NUMBER )

Get the boolean value of the given pin.

output( PIN_NUMBER, VALUE )

Set the boolean value of the given pin.

input_adc( ADC_PIN_NUMBER )

Get the value of the given ADC pin.

TODO

  • PWM

  • I2C

  • SPI

  • Serial

SEE ALSO

pcDuino Homepage: http://www.pcduino.com

Author Homepage: https://www.wumpus-cave.net

LICENSE

Copyright (c) 2014, Timm Murray All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.