I2C in python
-
-
Take a look at the ctypes library for Python. It allows you to call C library functions. It seems like it will work, but I'm waiting for some hardware before I can actually write and test any code. Once I get something working, I'll post it on Github.
-
Thank you guys!
Actually I already made a dock with the BME280 sensor.
I was porting it from raspberry to Onion, and it seems It will need more recoding than I thought since smbus is not working, but calling the i2ctools I think I will be able to make it work.Thanks!
-
hey guys,
might be a little late to the party, but we've just release the I2C library Python module.Check out this post: https://community.onion.io/topic/560/python-module-for-i2c-oled-library-update
And this wiki page: https://wiki.onion.io/Tutorials/Libraries/I2C-Library
-
@Lazar-Demin Thanks! I'm not that far along with my project, so it's definitely not too late for me.
-
I had trouble finding a good example that illustrated an I2C interaction between Python and the Arduino Dock. I found pieces, one in Python, and one for the Arduino, but not that matched. I gave up looking and cobbled together something stealing liberally from what I did find. Here is a link to my blog where I describe what I did (including sample code).
-
@Will-Kostelecky Yes, code for general Omega<-->Arduino communication is currently a bit thin on the ground.
I am currently working on such code since I need it - I will publish any code I produce.
See also https://community.onion.io/topic/212/how-to-access-arduino-dock-a0-from-terminal/6 on this
-
@Kit-Bishop I am doing one also, actually just a port of what I had done with serial communications based on an idea that I got from somewhere that I have since forgotten! Anyway, mine is a Python class that as written has methods for analog, digital, and PWM functions as well as support for up to four servos. I had also integrated a compass and an LCD display but as that was project specific I have pulled them out for what I will publish here. Given that it was a port it came together pretty quickly as I am now doing a sample "project" to test each of the class methods.
-
@Will-Kostelecky Sounds interesting. My version is in C/C++ since that is what I mainly need. Eventually I will also produce Java wrappers since eventually my main project will be in Java.
-
@Kit-Bishop I don't really have a project...have a hammer...looking for a nail!