rpi_gpio 0.4.0-dev.1

  • README.md
  • Installing
  • Versions
  • 71

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 library provides the API for accessing the various General Purpose I/O pins on the Raspberry Pi.

  • RpiGpio provides the implementation for the Gpio API derived from the WiringPi library.

Setup #

RpiGpio accesses the GPIO pins using a native library written in C. 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
  1. 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 blinking LED example demonstrates GPIO output by flashing an LED.

  • A read example demonstrates GPIO input by reading the current value for multiple pins.

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

  • A button example demonstrates reacting to GPIO input by turning on an LED whenever a button is pressed.

Changelog #

0.4.0 #

  • BREAKING CHANGES rework and simplify API
  • Upgrade for pre-2.0 and fix analyzer issues
  • Format dart code using dartfmt

0.3.0 #

  • BREAKING CHANGES so that the rpi_gpio package much more closely matches fletch gpio package
  • Removed GpioHardware.pinMode in favor of GPIO.setMode
  • Removed GpioHardware.digitalRead in favor of GPIO.getPin
  • Removed GpioHardware.digitalWrite in favor of GPIO.setPin
  • Removed Mode.pulsed in favor of Mode.output and pulseWidth
  • Removed GpioHardware.enableInterrupt in favor of RpiGPIO.setTrigger
  • Removed PWM (Pulse Width Modulation) support for pins other than pin 1
  • Removed top level input, output, pulsed const
  • Removed top level pullup, pulldown, pullOff const
  • Removed Gpio.pin method in favor of top level pin function
  • Removed RpiGPIO.gpioNum and Pin.gpioNum in favor of RpiGPIO.description
  • Moved classes similar to fletch gpio package into gpio.dart library
  • Moved Pin and related code into new gpio_pins.dart library
  • Renamed PinMode to Mode
  • Renamed PinPull to Pull
  • Renamed GpioException to GPIOException
  • Renamed GpioHardware to RpiGPIO
  • Renamed RpiHardware to WiringPiGPIO
  • Renamed MockHardware to MockGPIO
  • Renamed RecordingHardware to RecordingGPIO
  • Renamed RpiGPIO.pullUpDnControl to setPull
  • Renamed RpiGPIO.pwmWrite to setPulseWidth
  • Changed Pin.events from getter to a method that takes an optional parameter
  • Changed Pin.value and PinEvent.value from int to bool
  • Changed Gpio.hardware= to Pin.gpio=
  • Added optional RpiGPIO.description method
  • Added Mode.other to match fletch gpio package
  • Added abstract GPIO class to match fletch gpio package

0.2.2 #

  • Update wiringPi native code for Pi v2
  • Add top level pin function and deprecated Gpio.pin method
  • Add gpioNum method to return GPIO number for pin
  • Rework isRaspberryPi to check /etc/os-release
  • Rework and simplify examples

0.2.1 #

  • Fix bug to track both rising and falling interrupt edge
  • Fix bug that prevented application from completing normally when interrupts were used
  • Switch tests to use package:test rather than package:unittest
  • Fix read, polling, and interrupts examples to wait for rpi.loadLibrary() before proceeding.

0.2.0 #

  • Support for interrupts via Pin.events
  • Rename pin to pinNum
  • Improve build native library script
  • Rename repo to danrubel/rpi_gpio.dart

0.1.0 #

  • Read and write digital values
  • Hardware pulse width modulation on pin 1
  • Software simulated pwm for other pins (work in progress)

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  rpi_gpio: ^0.4.0-dev.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:rpi_gpio/rpi_gpio.dart';
Version Uploaded Documentation Archive
0.5.0 Sep 25, 2018 Go to the documentation of rpi_gpio 0.5.0 Download rpi_gpio 0.5.0 archive
0.2.2 Dec 25, 2015 Go to the documentation of rpi_gpio 0.2.2 Download rpi_gpio 0.2.2 archive
0.2.1+1 Aug 23, 2015 Go to the documentation of rpi_gpio 0.2.1+1 Download rpi_gpio 0.2.1+1 archive
0.2.1 Jul 18, 2015 Go to the documentation of rpi_gpio 0.2.1 Download rpi_gpio 0.2.1 archive
0.2.0 Jul 15, 2015 Go to the documentation of rpi_gpio 0.2.0 Download rpi_gpio 0.2.0 archive
0.1.0 Apr 28, 2015 Go to the documentation of rpi_gpio 0.1.0 Download rpi_gpio 0.1.0 archive
0.4.0-dev.1 Aug 24, 2018 Go to the documentation of rpi_gpio 0.4.0-dev.1 Download rpi_gpio 0.4.0-dev.1 archive
0.3.0-dev.1 Jan 2, 2016 Go to the documentation of rpi_gpio 0.3.0-dev.1 Download rpi_gpio 0.3.0-dev.1 archive
0.2.0-alpha.2 Jul 5, 2015 Go to the documentation of rpi_gpio 0.2.0-alpha.2 Download rpi_gpio 0.2.0-alpha.2 archive
0.2.0-alpha.1 Jun 23, 2015 Go to the documentation of rpi_gpio 0.2.0-alpha.1 Download rpi_gpio 0.2.0-alpha.1 archive

All 11 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on May 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.0
  • pana: 0.12.15


Detected platforms: other

Primary library: package:rpi_gpio/rpi_gpio.dart with components: nativewrappers.

Health suggestions

Format lib/gpio.dart.

Run dartfmt to format lib/gpio.dart.

Format lib/src/gpio_const.dart.

Run dartfmt to format lib/src/gpio_const.dart.

Maintenance suggestions

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and rpi_gpio.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.60.0 <3.0.0
path >=1.0.0 <2.0.0 1.6.2
Dev dependencies
grinder ^0.8.0
test ^1.2.0