I2C in Python on DragonBoard


#1

I see that Akira Tsukamoto went for a libmraa approach to programming for I2C bus.

I found python-smbus was a quick and easy way to get connected up. I can also recommend i2cdetect for querying the hardware. As my hardware was originally designed to be used with a Raspberry Pi, I used a simple level shifter circuit to connect it up, one of these for each of SDA and SCL.

Level Shifter

DragonBoard 410C I2C to drive a servo


#2

Hi @workshopshed,

Thank you for your great report! :slight_smile:

We would appreciate it if you could share your Python code here too. :slight_smile:

Best,


#3

Here’s the minimum you need to use the Picon Zero library.

import piconzero as pz

pz.init()

# Set output 0 mode to Servo
pz.setOutputConfig(0, 2)

# Move servo on output 0 to 90degrees
pz.setOutput (0,90)

pz.cleanup()

#4

Hi @workshopshed,

Four lines of code could control Servo on 96Boards.

Nice!!!
:slight_smile:


#5

Lol, yes, just 4 line plus one library for the board and one library for bus!