Adafruit Capacitive Hat – first approach

I got myself Adafruit’s new capacitive hat. This is my first foray into I2C (heck, I didn’t even know it required it!)

Adafruit says they’re working on a tutorial for their hat, but right now I get sent to the old tutorial which I follow dutifully. However when I try to run sudo python simpletest.py I get an File not found error in line if not cap.begin():.

Hmm. Puzzled…

Googling left and right points me to the fact that I2C is being used. This is a brand new Pi 2. Most likely I2C is not activated. So I run sudo raspi-config and I activate it (in the advanced options). I reboot, just to be certain.

Still no go.

A quick search on the Adafruit forums bring me to a thread where the user has a similar error, although not the same. In that thread, I discover a command to see if I2C is properly configured.

sudo i2cdetect -y 1
which should return
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- 5a -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Not my case. Nothing works. I just get an error which I forgot to write down. Back to googling. I find this ModMyPi tutorial: Loading I2C, SPI and 1-Wire drivers

nano /etc/modules
I add in
# SPI devices
spi-dev
# I2C devices
i2c-dev

and reboot. A call to lsmod shows me that I2C is up. I try the hat example again, and yeah! Thank you to all who took the time to write tutorials, so that little old ladies like me can have fun!

Advertisements