rpi_i2c 0.1.0 rpi_i2c: ^0.1.0 copied to clipboard
rpi_i2c is a Dart library for using I2C on the Raspberry Pi.
rpi_i2c.dart #
rpi_i2c is a Dart package for using I2C on the Raspberry Pi.
Overview #
-
The I2C library provides the API for accessing devices using the I2C protocol
-
The RpiI2C library provides implementation of the I2C protocol on the Raspberry Pi derived from the WiringPi library.
Setup #
Be sure to enable I2C on the Raspberry Pi using
sudo raspi-config
RpiI2C uses 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_i2c package.
- Activate the rpi_i2c package using the pub global command.
pub global activate rpi_i2c
- From your application directory (the application that references the rpi_i2c package) run the following command to build the native library
pub global run rpi_i2c:build_lib
pub global activate makes the Dart scripts in the rpi_i2c/bin directory runnable from the command line. pub global run rpi_i2c:build_lib runs the rpi_i2c/bin/build_lib.dart program which in turn calls the build_lib script to compile the native librpi_i2c_ext.so library for the rpi_i2c package.
Example #
- A Mpl3115a2 example demonstrates using the I2C protocol to read altitude, pressure, and temperature from a Mpl3115a2