Skip to content

Instantly share code, notes, and snippets.

View lsinger's full-sized avatar

Leif Singer lsinger

View GitHub Profile
@lsinger
lsinger / gist:3246923
Created August 3, 2012 11:55 — forked from ChickenProp/gist:3231712
Briefly: using an Adafruit LED Matrix with the Raspberry Pi

Adafruit sells an 8x8 LED matrix which you can control from a Raspberry Pi using I2C. Unfortunately they only provide Arduino code; I've only used I2C through the programs i2cset, i2cget, i2cdump and i2cdetect available from the i2c-tools package; and it wasn't immediately obvious how to use Adafruit's code to control the matrix from the Pi.

Fortunately, it turns out to be quite simple. i2c-tools seems to assume a register-based model of I2C devices, where the target device has up to 256 pointers which can be read and written. This doesn't seem to suit the HT16K33 chip (datasheet) that the matrix backpack uses. For example, when I ran i2cdump, which gets the value of each register, it started to blink a picture at me. At least I knew it was working.

Setting individual LEDs works much as you might expect. Every row has a single register, the eight bits of that register correspond to the eight LEDs on

@lsinger
lsinger / hack.sh
Created April 1, 2012 21:31 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#

From us ("the wishors") to you ("hereinafter called the wishee"):

Please accept without obligation, explicit or implicit, our best wishes for an environmentally conscious, socially responsible, politically correct, low stress, non-addictive, gender neutral, celebration of the winter solstice holiday, practiced within the most enjoyable traditions of the religious persuasion or secular practice of your choice, with respect for the religious/secular persuasions and/or traditions of others, or their choice not to practice religious or secular traditions.

Please also accept, under aforesaid waiver of obligation on your part, our best wishes for a financially successful, personally fulfilling and medically uncomplicated recognition of the onset of this calendar year of the Common Era, but with due respect for the calendars of all cultures or sects, and for the race, creed, colour, age, physical ability, religious faith, choice of computer platform or dietary preference of the wishee.

By accepting this greeting