rpi_gpio is a Dart package for accessing the Raspberry Pi GPIO pins.
The Gpio library provides the API for accessing the various General Purpose I/O pins on the Raspberry Pi.
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.
pub global activate rpi_gpio
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.
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.
Add this to your package's pubspec.yaml file:
dependencies: rpi_gpio: ^0.4.0-dev.1
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.5.0||Sep 25, 2018|
|0.2.2||Dec 25, 2015|
|0.2.1+1||Aug 23, 2015|
|0.2.1||Jul 18, 2015|
|0.2.0||Jul 15, 2015|
|0.1.0||Apr 28, 2015|
|0.4.0-dev.1||Aug 24, 2018|
|0.3.0-dev.1||Jan 2, 2016|
|0.2.0-alpha.2||Jul 5, 2015|
|0.2.0-alpha.1||Jun 23, 2015|
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]
We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: other
dartfmt to format
dartfmt to format
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
rpi_gpio.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.