raspi_gpio 0.0.1 copy "raspi_gpio: ^0.0.1" to clipboard
raspi_gpio: ^0.0.1 copied to clipboard

PlatformAndroid

A Flutter plugin for controlling Raspberry Pi GPIO pins, supporting LED control, motor control, and button input.

Raspi GPIO Flutter Plugin #

A Flutter plugin for controlling Raspberry Pi GPIO pins on Android Things OS. This plugin provides an easy-to-use interface for controlling LEDs, motors, and reading button inputs on a Raspberry Pi.

Features #

  • Control LEDs (turn on/off)
  • Control motors with PWM speed control
  • Read button input states
  • Support for multiple GPIO pins
  • Event-based button state monitoring

Getting Started #

Prerequisites #

  • Flutter SDK
  • Android Things OS on Raspberry Pi
  • Android Studio or VS Code with Flutter extensions

Installation #

Add the following to your pubspec.yaml:

dependencies:
  raspi_gpio: ^0.0.1

Usage #

  1. Initialize the GPIO:
await RaspiGpio.initialize();
  1. Control an LED:
await RaspiGpio.setLedState(18, true); // Turn on LED on pin 18
  1. Control a motor:
await RaspiGpio.controlMotor(
  in1Pin: 22,
  in2Pin: 23,
  enPin: 24,
  speed: 50, // 0-100
  direction: true, // true for forward, false for backward
);
  1. Listen to button presses:
RaspiGpio.listenToButton(17).listen((state) {
  print('Button state: $state');
});

Example #

See the example directory for a complete example app demonstrating all features.

Pin Configuration #

The example app uses the following pin configuration:

  • LED: GPIO 18
  • Motor IN1: GPIO 22
  • Motor IN2: GPIO 23
  • Motor EN (PWM): GPIO 24
  • Button: GPIO 17

You can modify these pin numbers according to your hardware setup.

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

2
likes
160
points
85
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for controlling Raspberry Pi GPIO pins, supporting LED control, motor control, and button input.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on raspi_gpio