Git Product home page Git Product logo

gpio_zero-ruby's Introduction

GPIO Zero for Ruby

Quick setup

Ruby 2.3.3 is installed by default on the Raspberry Pi but there are a couple of other packages required:

sudo apt install ruby-bundler ruby-dev

To be able to install gems without root access it is necessary to set the location of gem files:

cat export GEM_PATH=~/.gems >> ~/.bashrc

Alternative setup

To use the latest version of Ruby a version manager such as RVM can be used. Note that this will build Ruby from source and on a Raspbery Pi version before 3 can take (literally) hours.

The RVM installer doesn't quite set itself up properly for Linux. This can be fixed with:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" >> ~/.bashrc

First steps

GPIO Zero depends on the pigpgiod daemon and so this need to be started first:

sudo /usr/bin/pigpiod

After that connect an LED up to pin 4 and try:

bundle install
bundle exec ruby test.rb

Documentation

Current features

  • LED, on and off

To do

Essentially, everything that exists in the Python GPIO Zero library, but in the short term the following features appear in the 'Basic Recipes' section of the documentation, ordered in (approximate) order of priority:

  • Other LED features. Eg, blink.
  • Button
  • PWMLED
  • Buzzer
  • RGBLED
  • MotionSensor
  • LightSensor
  • DistanceSensor
  • Motor
  • CPUTemperature
  • LEDBoard
  • LEDBarGraph
  • TrafficLights
  • FishDish
  • TrafficHat
  • Robot
  • MCP3008
  • Energenie
  • TimeOfDay
  • PingServer
  • tools.negated

For simplity, and as far as possible, the naming convention will follow the names in the Python libraries.

References

This project is based on the Python GPIO Zero libraries.

gpio_zero-ruby's People

Contributors

jrmhaig avatar ozzy avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.