Coder Social home page Coder Social logo

ws2812's Introduction

What's this

Ruby wrapper around WS2812 LED driver for Raspberry Pi.

Or, to be more specific, a Ruby gem that encapsulates modified RPi ws281x library from UnicornHAT to help drive your WS2812 led chain (or matrix) from Raspberry Pi.

These WS281x LEDs are sometimes also known as NeoPixels.

Installation

As this is a published Ruby gem,

gem install ws2812

should be enough. But the examples will be hidden in 'gems' dir.

If you want to avoid the gem route, the following works just as well:

git clone https://github.com/wejn/ws2812
cd ws2812
# Assuming raspbian here; otherwise make sure you have 'mkmf'
# and can compile exts (failing that "rake compile" will bomb on you)
sudo apt-get update
sudo apt-get install -y ruby-full
# .
sudo gem install rake rake-compiler
rake compile
# and then, to demo it:
sudo ruby examples/digiclock.rb

Examples

See the examples directory from the gem (or GH repo).

License

GNU General Public License v. 2, see LICENSE.txt.

Authors

This gem (all of the ruby code and some tweaks to the C extension) was originally created by Michal Jirků [email protected], later extended by Philip Howard [email protected] to support newer Pi-s, and by Derek Stotz [email protected] to support Buster.

And it wouldn't be possible without the original UnicornHAT repo.

From that repo I not only took inspiration when it comes to the interface, but I also also translated bits and pieces from Python to Ruby.

And, in turn, the UnicornHAT repo wouldn't be possible without Richard Hirst's modification of Jeremy Garff's RPi ws281x library.

Thanks to you both.

Links

ws2812's People

Contributors

dstotz avatar gadgetoid avatar wejn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ws2812's Issues

Error while installing

Hi, I'm trying to install this gem on my Raspberry Pi 2, but I'm getting the following error message:

pi@babblepi:~ $ sudo gem install ws2812
Fetching: ws2812-0.0.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing ws2812:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.1 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/ws2812-0.0.2 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/arm-linux/2.1.0/ws2812-0.0.2/gem_make.out

I'm running the latest version of Raspbian, via NOOBS 1.8

Update 1

I've just installed ruby2.2-dev via sudo apt-get install ruby2.2-dev then tried again, and got a new error message:

pi@babblepi:~ $ sudo gem install ws2812
Building native extensions.  This could take a while...
ERROR:  Error installing ws2812:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.1 extconf.rb
creating Makefile

make "DESTDIR=" clean
rm -f Makefile

make "DESTDIR="
make: *** No targets specified and no makefile found.  Stop.

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.1.0/gems/ws2812-0.0.2 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/arm-linux/2.1.0/ws2812-0.0.2/gem_make.out

Update 2

Having just followed the manual install instructions, I'm now getting yet another error message:

pi@babblepi:~/Git/ws2812 $ sudo ruby examples/digiclock.rb
/home/pi/Git/ws2812/lib/ws2812/basic.rb:80:in `open': init failed with code: -1, perhaps you need to run as root? (RuntimeError)
        from /home/pi/Git/ws2812/lib/ws2812/unicornhat.rb:30:in `initialize'
        from examples/digiclock.rb:97:in `new'
        from examples/digiclock.rb:97:in `<main>'
pi@babblepi:~/Git/ws2812 $

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.