rpi_i2c 0.4.0 copy "rpi_i2c: ^0.4.0" to clipboard
rpi_i2c: ^0.4.0 copied to clipboard

PlatformLinux

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

example/example.dart

import 'dart:async';

import 'package:rpi_i2c/rpi_i2c.dart';

import 'mpl3115a2.dart';

void main() async {
  final i2c = RpiI2C();
  await readSensor(Mpl3115a2(i2c));
  i2c.dispose();
}

Future readSensor(Mpl3115a2 mpl3115a2) async {
  print('Pressure and temperature:');
  var result = await mpl3115a2.read();
  print('  pressure: ${result.pressure} pascals');
  print('  temperature: ${result.temperature} celsius');

  print('Altitude and temperature:');
  result = await mpl3115a2.read(altitude: true);
  print('  altitude: ${result.altitude} meters');
  print('  temperature: ${result.temperature} celsius');
}
5
likes
140
points
44
downloads

Publisher

verified publisherdanrubel.net

Weekly Downloads

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

ffi, path

More

Packages that depend on rpi_i2c