This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |