pub package Build Status Coverage Status

rpi_i2c is a Dart package for using I2C on the Raspberry Pi.


  • 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.


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.

  1. Activate the rpi_i2c package using the pub global command.
    pub global activate rpi_i2c
  1. 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.