I2C in python
-
In python I just had idea how to use it. Principally I can use whatever language. Is there any example of using I2C protocol?
-
@Petr-Cermak We have a library in C here: https://github.com/OnionIoT/i2c-exp-driver. However, we haven't gotten around to writing the documentation for it yet. Please see if you can figure it out just by looking at the code. We will be working on the documentation for this library mid next week.
-
Thanks a lot @Boken-Lin, I just wanted to know if I did not miss something.
I understand that you are very busy with other stuff and I am not working on something so important. So fingers crossed with all ONION features, it looks great!
-
Does anyone actually is using I2C and python and how are you doing it?
My main issue is with installing Smbus since other python wrappers i use for exemple on Rpi, actually use python-smbus, which i can't figure out how to put it in the onion.
Anybody?
Thanks
-
It would be really useful to be able to handle I2C in Python, is there any work around about this?
Thank you!
-
-
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!