I'm trying to grasp the basic bus.write_byte() and bus.read_byte() commands for the pcf8574.
The 8574 datasheet is clear how to do that with the LSbit in the slave address as a R/W command.
http://html.alldatasheet.com/html-pdf/1 ... F8574.html
What I don't understand is how SmBus handles this, as there are only 2 arguments for a write instruction.
Q1: how do I set which lines are input or output, followed in the second step outputting the value?
Code: Select all
bus=SMBus(0) # (in Python)
addr=0x38
bus.write_byte(addr, 0xff) # set P0-7 in output mode
bus.write_byte(addr, 0x01) # set P0=1 ??????? this doesn't workI would appreciate an example. After hours of Googling found nothing that quite answers these questions....
Thanks...
D.