Skip to content

mschiller/WiringLMK-Ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WiringLmk

WiringLmk is an implementation of most of the Arduino Wiring functions for the Banana Pi, this gem is a wrapper for the main wiringpi library and provides a nice OO interface with a few other handy helpers.

Installation

Install with gem install wiring_lmk or use bundler's Gemfile

source 'https://rubygems.org'

gem 'wiring_lmk' # https://github.com/mschiller/WiringLmk-Ruby

then: bundle install

Example

#!/usr/bin/env ruby

require 'bundler'
Bundler.setup
Bundler.require

io = WiringLmk::GPIO.new do |gpio|
  gpio.pin_mode(0, WiringLmk::OUTPUT)
  gpio.pin_mode(1, WiringLmk::INPUT)
end

pin_state = io.digital_read(1) # Read from pin 1
puts pin_state

io.digital_write(0, WiringLmk::HIGH) # Turn pin 0 on
io.delay(100)                       # Wait
io.digital_write(0, WiringLmk::LOW)  # Turn pin 0 off

You will need to run your scripts as root because WiringLmk accesses /dev/mem

Reference

Pins

For a complete run-down see the pins page of the wiringpi website. alt text alt text

More

Full details on the wiringpi website.

About

Version 2.x of Gordon Henderson's Arduino-like WiringPi GPIO functions, wrapped up for Ruby.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 89.2%
  • Makefile 3.4%
  • C++ 2.2%
  • Roff 1.7%
  • Shell 1.6%
  • Ruby 1.2%
  • TeX 0.7%