Dart library for accessing the Raspberry Pi GPIO pins
C Dart C++ Makefile Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
example
lib
test
tool
.gitignore
.travis.yml
AUTHORS
CHANGELOG.md
LICENSE
README.md
pubspec.yaml

README.md

rpi_gpio.dart

pub package Build Status Coverage Status

rpi_gpio is a Dart package for accessing the Raspberry Pi GPIO pins.

Overview

  • The gpio_pins library provides Pin objects for accessing the various General Purpose I/O pins on the Raspberry Pi.

  • WiringPiGPIO provides a low level API for accessing the GPIO pins on the Raspberry Pi using the WiringPi library.

Setup

WiringPiGPIO accesses the GPIO pins using a native library written in C and built on top of the wiringPi library. For security reasons, authors cannot publish binary content to pub.dartlang.org, so there are some extra steps necessary to compile the native library on the RPi before this package can be used. These two steps must be performed when you install and each time you upgrade the rpi_gpio package.

1) Activate the rpi_gpio package using the pub global command.

    pub global activate rpi_gpio

2) From your application directory (the application that references the rpi_gpio package) run the following command to build the native library

    pub global run rpi_gpio:build_lib

pub global activate makes the Dart scripts in the rpi_gpio/bin directory runnable from the command line. pub global run rpi_gpio:build_lib runs the rpi_gpio/bin/build_lib.dart program which in turn calls the build_lib script to compile the native librpi_gpio_ext.so library for the rpi_gpio package.

Examples

  • A read pins example demonstrates reading the current value for multiple pins using the high level gpio_pins library.

  • A second read pins example demonstrates mocking the hardware so that the logic can be run and tested on platforms other than the Raspberry Pi.

  • A blinking LED example and a motor driver example demonstrate using the high level gpio_pins library.

  • A second blinking LED demonstrates using the low level WiringPiGPIO API.

  • The value of GPIO pins can be tracked over time via interrupts or polling.