https://github.com/j-jzk/rbwiringop
Ruby library for WiringOP
https://github.com/j-jzk/rbwiringop
gpio gpio-pins orange-pi ruby
Last synced: 7 months ago
JSON representation
Ruby library for WiringOP
- Host: GitHub
- URL: https://github.com/j-jzk/rbwiringop
- Owner: j-jzk
- License: bsd-3-clause
- Created: 2018-11-22T15:09:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-29T21:40:46.000Z (almost 6 years ago)
- Last Synced: 2025-01-21T19:21:24.367Z (9 months ago)
- Topics: gpio, gpio-pins, orange-pi, ruby
- Language: Ruby
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RbWiringOP
Ruby library for easier use of [zhaolei's WiringOP](https://github.com/zhaolei/WiringOP).
It simplifies calling the shell commands and adds a nice Ruby interface.## Installation
First download and install the WiringOP.
```
git clone https://github.com/zhaolei/WiringOP.git -b h3
cd WiringOP
chmod +x ./build
sudo ./build
```
*(from WiringOP readme)*Then clone this repository:
```
git clone https://github.com/j-jzk/RbWiringOP.git
```## Usage
```ruby
require './RbWiringOP/wiring.rb'# reset the gpio (not required)
WiringOP.resetmy_pin = WiringOP::Pin.new :pin => 0, :direction => :out # the library uses WiringPi pin numbering
# do something with the pin
my_pin.set_hi
my_pin.set_lo# an input pin
another_pin = WiringOP::Pin.new :pin => 4, :direction => :in# check the value
if another_pin.is_hi
# do something
end
# or
if another_pin.is_lo
# do something
end
```