Project

gpio_sysfs

0.0
No commit activity in last 3 years
No release in over 3 years
Portable sysfs-driven GPIO library for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.10.0
 Project Readme

Summary

gpio_sysfs is a simple, cross-platform GPIO library for Ruby that interacts with sysfs without any gem dependencies. This allows this library to interact with a variety of GPIO interfaces from various vendors with ease.

Unlike some similar libraries, gpio_sysfs does not read and write to /dev/mem, which requires the root user to be running the code. The user only needs to have write access to /sys/class/gpio.

Usage

To read from a pin:

require "gpio_sysfs"

pin = GpioSysfs::Pin.new(18)
pin.direction = "in"

pin.value  # Returns true or false.

To write to a pin:

require "gpio_sysfs"

pin = GpioSysfs::Pin.new(18)

pin.value = true

Testing

The test suite will run on any machine with:

bundle exec rspec