パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.10.0

rpi_gpio

rpi_gpio は、Raspberry Pi の GPIO ピンにアクセスするための Dart ライブラリです。

Linux
30日間ダウンロード
48
いいね数
33
Pub ポイント
150

パッケージをインストール

flutter pub add rpi_gpio

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

rpi_gpio は、Linux システム上で Raspberry Pi の GPIO ピンに直接アクセスできる Dart ライブラリです。開発者がデジタル入出力を制御し、センサーや LED、モーターなどの物理ハードウェアとのインタラクションを可能にします。IoT アプリケーション向けに設計されており、Raspberry Pi 上で実行される Flutter または独立した Dart プロジェクトにおいて、GPIO 機能の管理を簡単なインターフェースで行うことができます。このパッケージは、Raspberry Pi が動作する Linux 環境とシームレスに統合されており、組み込みおよびリアルタイムのハードウェア制御シーンに最適です。

用途

  • LEDとリレーの制御
  • GPIOからセンサデータを読み取る
  • ホームオートメーションシステムの構築
  • インタラクティブなIoTデバイスの作成
  • ロボティクスインターフェースの開発

主な機能

  • GPIO ピンへの直接アクセス
  • Linux専用の互換性
  • 入出力制御のためのシンプルな API
  • 割り込みベースのイベントをサポートします
  • 軽量で最小限の依存関係

適している対象

  • Raspberry Pi デベロッパー
  • IoTハッカー
  • ハードウェア連携型Flutterアプリ
  • 組み込みシステムプロジェクト
  • リアルタイムデバイス制御

注意事項

  • Linux を搭載した Raspberry Pi でのみ動作します
  • 一部の操作にはルート権限が必要です
  • Linux プラットフォームに限定
  • 他のマイコンコントローラーには対応していません
  • GPIO権限の追加設定が必要になる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

rpi_gpio.dart

pub package

rpi_gpio is a Dart package for accessing the Raspberry Pi GPIO pins.

Overview

  • Gpio provides the API for accessing the various General Purpose I/O pins on the Raspberry Pi.

  • RpiGpio provides the implementation for the Gpio API via the native libgpiod.so.2 library.

Setup

Installing libgpiod (should already be installed)

RpiGpio accesses the GPIO pins using the native libgpiod.so.2 library. If you are running the latest Raspberry Pi OS (formerly Raspbian), then this library should already be installed by default on your Raspberry Pi. If you are unsure, see #2 below in the troubleshooting section. If it is not already installed, open a terminal and run

sudo apt update
sudo apt install libgpiod2

Example

The example launches the example app to demonstrate:

  • Blinking an LED along with software based PWM on a second LED.

  • Responding to a button press by turning on an LED.

The example is structured such that the example test can inject a mock gpio to facilitate testing and allow test execution on platforms other than the Raspberry Pi.

Testing

Latest Raspberry Pi OS (2024-05-29)

Raspberry Pi Hardware Dart version
Pi 5 Model B Rev 1.0 3.3.4 (stable) (Tue Apr 16 19:56:12 2024 +0000) on "linux_arm64"
Pi 3 Model B Rev 1.2 3.3.4 (stable) (Tue Apr 16 19:56:12 2024 +0000) on "linux_arm64"
Pi 2 Model B Rev 1.1 3.3.4 - 32 bit
Pi 1 Model B Rev 2 unsupported

Troubleshooting

  1. Run test/src/native/show_hardware_and_os.dart and record the output

  2. Run test/src/native/show_lib_version.dart to see if the libgpiod.so.2 library can be located

  3. If running test/src/native/blink_led.dart crashes then there may be a 32 bit / 64 bit mismatch. Check that the board, the OS, and the Dart SDK are all either 32 bit or 64 bit.

  4. If running test/src/native/blink_led.dart doesn't crash, but doesn't blink the LED (where the LED and resistor are connected in series to GPIO 17 (pin 11) and ground) then

sudo apt-get install libgpiod-dev
gpioinfo

and and check to see that the gpiochip# listing all of the GPIO# (for example "gpiochip4" below)

$ gpioinfo
gpiochip0 - 32 lines:
  ...
gpiochip4 - 54 lines:
	line   0:     "ID_SDA"       unused   input  active-high
	line   1:     "ID_SCL"       unused   input  active-high
	line   2:      "GPIO2"       unused   input  active-high
	line   3:      "GPIO3"       unused   input  active-high
	line   4:      "GPIO4"       unused   input  active-high
  ...

matches the Gpio Chip information in #1 above. (for example "gpiochip4" below)

$ dart test/src/native/show_hardware_and_os.dart
CPU          : aarch64
  ...
Is Rpi 5     : true
Gpio Chip    : gpiochip4

カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。