-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't import usmbus SMBus #2
Comments
Hi there, It looks like your python interpreter just can't find the usmbus module: how did you go about installing it? You should be able to see the list of places python is looking for modules with:
I don't have micropython handy but having the |
I did not give any installation commands, I thought they were already part of the micropython kernel. Do you look at the OpenEletronics_i2c.py module? Will I have to make many changes to the code to stop using your smbus? Do you think I'd better adapt OpenEletronics_i2c.py with the micropython library machine? |
Hi, There are different ways you could tackle this, but it would help to know what you're trying to do: is there a particular sensor you're trying to use? |
first of all, thanks for the help. this is the sensor in case: http://www.mindsensors.com/rpi/76-smartdrive-high-current-motor-controller I made a driver for it in java: and thought of doing in _ c ++_: would be specifically pro esp32, but I prefer micropython |
Can you help me more |
I think this module can help you here - all you need to do is install it alongside the If you call it I'm also not sure whether the |
I’m not sure how your environment is set up, so unsure what to suggest. Are you using a python board of some kind? How are you getting the openelectrons code onto it? As a brute force method you could just copy the SMBus class into your file above the openelectrons class |
I'm trying to use usmbus SMBus on an esp32 with 30 pin espressif running micropython. I already rode OpenElectrons_i2c on (and run motors with i2c smartdrive-drive) a raspberry pi 3 and an intel edison, but these two platforms ran normal python and not micropython, so I could use the modules smbus (python normal) and ctypes. You said:"As a brute force method you could just copy the SMBus class into your file above the openelectrons class" How can I do this? (pls) |
How are you getting the openelectrons file onto your esp32 board at the moment? Do you have it connected via USB? When I'm developing on an esp8266 I have it connected via USB, and use the micropython IDE extension: https://marketplace.visualstudio.com/items?itemName=dphans.micropython-ide-vscode This allows you to copy files onto the board, so to use |
Something like this is what I was imagining: https://gist.github.com/gkluoe/83b11673484c1a8a4e555607ad52c362 |
@gkluoe hi https://github.com/neuberfran/SmartMPython I would appreciate it if you continued to help me solve this project and make engines move. I created the file main.py, but it does one only error |
Hi - the problem in this picture, I think, is that you're using python 2 syntax, and micropython is (roughly) Python 3. In python 3, you need to use the
Should work. If you fix up all the print statements, hopefully that will help! |
@gkluoe Tks _ Look:_
https://github.com/neuberfran/SmartMPython/blob/master/OpenElectrons_i2c.py |
Hmm, OK, now I think your issue is here: The You could re-implement these functions - in theory that's quite simple - all they do is convert a python To be honest, at this point it's probably going to be easier to just rewrite the OpenElectrons_i2c.py module to work natively in micropython. I'd love to help with that but without your hardware to test on, I don't think I can. |
https://github.com/neuberfran/SmartMPython/invitations any PR will be welcome |
Hi,
I need transpose this project:https://github.com/neuberfran/OpenElectrons_i2c/blob/master/OpenElectrons_i2c.py
from python to micropython, but I have issue:
The text was updated successfully, but these errors were encountered: