1.Make sure your I2C driver are enable
To enable it all you need to do is comment out a line by putting # in front
sudo nano /etc/modprobe.d/raspi-blacklist.conf
2. Add i2c-dev in /etc/modules by use
sudo nano /etc/modules
3. Next install the python-smbus
python module:
sudo
apt-get install python-smbus
sudo
apt-get install i2c-tools
Now
you are ready to use the i2c with python.
If you already install I2c driver ,
i2cdetect -y 0 - for Raspberry Pi V1 Board
i2cdetect -y 1
-
for Raspberry Pi V2 Board
https://pypi.python.org/pypi/RPi.GPIO
GPIO library
GPIO library -
RPi.GPIO-0.5.2a.tar.gz
2013-03-25
RPi.GPIO-0.5.3a.tar.gz
2013-06-23
RPi.GPIO-0.5.6.tar.gz
2014
RPi.GPIO-0.5.7.tar.gz
2014
Install python , library and run the test program
# sudo apt-get install python-dev
# wget http://www.pridopia.co.uk/pi-pgm/RPi.GPIO-0.5.7.tar.gz
# gunzip RPi.GPIO-0.5.7.tar.gz
# tar –xvf RPi.GPIO-0.5.7.tar
# cd RPi.GPIO-0.5.7
# sudo python setup.py install
|