Ask A Question

Notifications

You’re not receiving notifications from this thread.

Ruby gems to interact with Raspberry Pi GPIO

Aware asked in Ruby

I'm doing a small project in Sinatra where I want to unlock my doors via internet and Pi. Super simple. I'm still learning Ruby and Rails. I was searching for a Ruby GPIO gem and there is a quite few of them on GitHub but most of them haven't been updated in years. And when I try them they are mostly not working. Can someone recommend me, or knows about, a Ruby gem that is up to date and working with Pi GPIO?

Thank you in advance,

Mirko

Reply

What have you tried?

Reply

I can't remember all of them because I dabbled with that couple of months ago. Most of them are more than 5-6 years without a commit. Didn't cross my mind I could search for help here. What I can recall is that rpi_gpio gem was 32bit but my ubuntu server is 64bits.

c_GPIO gem would always give me "uninitialized constant GPIO::Led (NameError)" for "led = GPIO::Led.new(pin: 17)" so I gave up there.

pi_piper is what I tried last and that one sort of works. First time when I send a request it works, second request gives me this error. "Errno::EBUSY - Device or resource busy @ fptr_finalize_flush - /sys/class/gpio/export (Errno::EBUSY)"

Something like pin on, sleep 2 sec, pin off should be fairly easy and I've done it successfully in Python I am not able to make it work with Ruby :/

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.