Rasp-Hack-Led-Backpack-I2C

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche

The Holtek HT16K33 chip used in all of our backpacks communicates using the common I2C bus. Linux and the Pi both have native support for I2C, but you'll need to run through a couple quick steps from the console before you can use it in Python.

If you are running Occidentalis and are familiar with Terminal commands, then the description below will be sufficient.

If not, then to learn more about how to setup I2C with either Raspbian or Occidentalis, then take a minor diversion to this Adafruit Tutorial: Configurer I2C sur Raspberry Pi

sudo apt-get install python-smbus
sudo apt-get install i2c-tools

i2c-tools isn't strictly required, but it's a useful package since you can use it to scan for any I2C or SMBus devices connected to your board. If you know something is connected, but you don't know it's 7-bit I2C address, this library has a great little tool to help you find it:

sudo i2cdetect -y 1

This will search /dev/i2c-0 for all address, and if a Holtek HT16K33 breakout is properly connected and it's set to it's default address it should show up as follows (the exact address will vary depending on whether or not you have any of the address solder jumpers set).

If you happen to have one of the original first batch of Raspberry Pis, you will need to change the 1 to a 0 in the command above.

Rasp-Hack-Led-Backpack-I2C-01.png

Once both of these packages have been installed, you have everything you need to get started accessing I2C and SMBus devices in Python.



Source: AdaFruit

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.