Arquivo mensal: Agosto 2014

Interrupções no Raspberry Pi

http://raspi.tv/2013/how-to-use-interrupts-with-python-on-the-raspberry-pi-and-rpi-gpio

http://www.thebox.myzen.co.uk/Raspberry/Magic_Wand.html

http://makezine.com/projects/tutorial-raspberry-pi-gpio-pins-and-python/

http://blog.oscarliang.net/use-gpio-pins-on-raspberry-pi/

http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/

 

https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code

class Adafruit_I2C(object):

def __init__(self, address, busnum=-1, debug=False):
# By default, the correct I2C bus is auto-detected using /proc/cpuinfo
# Alternatively, you can hard-code the bus version below:
# self.bus = smbus.SMBus(0); # Force I2C0 (early 256MB Pi’s)
# self.bus = smbus.SMBus(1); # Force I2C1 (512MB Pi’s)
def write8(self, reg, value):
“Writes an 8-bit value to the specified register/address”
def write16(self, reg, value):
“Writes a 16-bit value to the specified register/address pair”
def writeRaw8(self, value):
“Writes an 8-bit value on the bus”
def writeList(self, reg, list):
“Writes an array of bytes using I2C format”
def readList(self, reg, length):
“Read a list of bytes from the I2C device”
def readU8(self, reg):
“Read an unsigned byte from the I2C device”
def readS8(self, reg):
“Reads a signed byte from the I2C device”
def readU16(self, reg, little_endian=True):
“Reads an unsigned 16-bit value from the I2C device”
def readS16(self, reg, little_endian=True):
“Reads a signed 16-bit value from the I2C device”

http://wiki.erazor-zone.de/wiki:linux:python:smbus:doc

self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
self.bus.write_byte_data(self.address, reg, value)
self.bus.write_word_data(self.address, reg, value)
self.bus.write_byte(self.address, value)
self.bus.write_i2c_block_data(self.address, reg, list)
results = self.bus.read_i2c_block_data(self.address, reg, length)
result = self.bus.read_byte_data(self.address, reg)
result = self.bus.read_word_data(self.address,reg)