09-03-2017, 10:33 PM
(This post was last modified: 09-03-2017, 11:31 PM by psychedup.
Edit Reason: fixed typo
)
(09-03-2017, 03:43 PM)martinayotte Wrote: Since I'm running Armbian, I'm using /dev/i2c-1 instead of /dev/twi1.
But here is some code I'm using to make some LEDs flashing on an MCP23017 :
Code:#!/usr/bin/env python
import sys, time
from RPi import I2C as i2c
i2c.init("/dev/i2c-1")
i2c.open(0x20)
i2c.write([0x00, 0x00])
i2c.write([0x01, 0x00])
while True:
i2c.write([0x12, 0x0F])
i2c.write([0x13, 0x0F])
time.sleep(0.15)
i2c.write([0x12, 0xF0])
i2c.write([0x13, 0xF0])
time.sleep(0.15)
Thanks, I found the problem thanks to your example. I was trying to open "/dev/twi1" which didn't exist. It's /dev/i2c-1. For some reason when I run i2cdetect or i2cdump they want me to use twi1 as an alias to /dev/i2c-1 so I got them mixed up.
Now it is reading from the device. I just have to figure out what to do with the results

Thanks for your help.