Ruby, GPIO, and flashing LEDs


#1

I finally took delivery of a big box of things to plug into my CHIP, so it’s time to start learning in earnest.

I followed the directions from @fordsfords (on the wiki) to wire up two LEDs to two XIO pins. Then — because I’m me — I had to figure out how to drive them from Ruby!

I found a couple of existing GPIO gems (pi_piper, gpio), but they were both too complicated for me to figure out how to make them work for the CHIP before I got annoyed.

So I wrote my own: https://github.com/willia4/chip-gpio. It is very basic right now, but I intend to add more features (event-driven inputs, PWM, etc.) as I get deeper into my projects.

For now, at least, it’s good enough to flash some LEDs. So I wrote a little ruby script to do just that: https://github.com/willia4/chip-experiments/tree/master/ping_pong_flash.

The end result: 4MB GIF File of Two LEDs Flashing

Now, to figure out what to do with independently controlled LEDs…


#2

Try something like this


#3

I’m gonna need more LEDs.


#4

Never can have too many LEDs.

I’m thinking about how to build a “modular” 8x8x8 LED matrix. They sell kits for $200-300, but I’d prefer a design that’s easier to construct and repair.