def __init__(self, busNum):
#print "init PCF8591"
if busNum == 0:
self.__bus = SMBus(0) # on a Rev 1 board
#print "bus 0"
else:
self.__bus = SMBus(1) # on a Rev 2 board
self.__addr = self.__checkI2Caddress(0x48)
self.__DACEnabled = 0x00
print self.readADC() # dummy call to raise exception if no chip presnt on the i2c bus
print "PCF8591 init completed"
# self.__bus = __i2cBus
# self.__addr = self.__checkI2Caddress(__addr)
# self.__DACEnabled = 0x00
# i2c = SMBus(0) # on a Rev 1 board
# # i2c = SMBus(1) # if on a Rev 2 board
# # Create a PCF8591P object
# sensor = PCF8591P(i2c, 0x48)
# Read single ADC Channel
评论列表
文章目录