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

outdated

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';

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');
}
4
likes
90
pub points
28%
popularity

Publisher

verified publisherdanrubel.net

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

path

More

Packages that depend on rpi_i2c