Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import smbus
import sys
import time
bus = smbus.SMBus(1)
address = 0x20
bus.write_byte_data(address,0x00,0x00) # set A7-A0 as output pins
bus.write_byte_data(address,0x01,0x07) # set B0-B3 as input pins , B4-7 as output 0000111