hxPiGpio

Haxe/OpenFL extension for using the GPIO Ports on the Rapberry Pi through wiringPi
https://codeberg.org/gepatto/hxPiGpio

To install, run:

haxelib install hxPiGpio 0.1.2 

See using Haxelib in Haxelib documentation for more information.

README.md

hxPiGpio

Haxe/OpenFL extension for using the GPIO Ports on the Rapberry Pi

Requires wiringPi to be installed.
Not all methods in WiringPi are exposed!

Installation

cd into a directory where you store haxe modules that are not in the haxelib repo

git clone https://codeberg.org/gepatto/hxPiGpio
haxelib dev hxPiGpio hxPiGpio/
cd hxPiGpio
lime rebuild . rpi -clean

example usage

add the following to your openfl project.xml
<haxelib name="hxPiGpio" />

read a digital input

PiGpio.wiringPiSetupGpio();
PiGpio.pinMode( 18, PiGpio.INPUT ); // 18 is gpio18
var pinValue = PiGpio.digitalRead(18);
trace(pinValue);

Requirements

make a file called /etc/udev/rules.d/20-gpio.rules with the following file contents

SUBSYSTEM=="bcm2835-gpiomem", KERNEL=="gpiomem", GROUP="gpio", MODE="0660" SUBSYSTEM=="gpio", KERNEL=="gpiochip", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'" SUBSYSTEM=="gpio", KERNEL=="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"

add the following environment variable:

export WIRINGPI_GPIOMEM=1

wiringpi reference

Contributors
Gepatto
Version
0.1.2
Published
8 months ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub