Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/synthead/gpio_sysfs
Portable sysfs-based GPIO library for Ruby
https://github.com/synthead/gpio_sysfs
Last synced: 3 days ago
JSON representation
Portable sysfs-based GPIO library for Ruby
- Host: GitHub
- URL: https://github.com/synthead/gpio_sysfs
- Owner: synthead
- Created: 2021-11-29T06:01:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-29T09:13:15.000Z (almost 3 years ago)
- Last Synced: 2024-03-25T01:42:45.018Z (8 months ago)
- Language: Ruby
- Size: 5.86 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this 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:
```ruby
require "gpio_sysfs"pin = GpioSysfs::Pin.new(18)
pin.direction = "in"pin.value # Returns true or false.
```To write to a pin:
```ruby
require "gpio_sysfs"pin = GpioSysfs::Pin.new(18)
pin.value = true
```# Testing
The test suite will run on any machine with:
```shell
bundle exec rspec
```