I'm just trying to get started with i2c on the micro:bit. I'm using Mu and have entered this simple program...
from microbit import *
print(i2c.scan())
And I'm getting this error....
Traceback (most recent call last):
File "__main__", line 3, in <module>
AttributeError: 'MicroBitI2C' object has no attribute 'scan'
MicroPython v1.7-9-gbe020eb on 2016-04-18; micro:bit with nRF51822
Type "help()" for more information.
>>>
Help please!!
AttributeError: 'MicroBitI2C' object has no attribute 'scan'
-
- Posts: 363
- Joined: Sun Apr 17, 2016 1:55 pm
Re: AttributeError: 'MicroBitI2C' object has no attribute 'scan'
You need micropython 1.9.2 for microbit to use i2c.scan(). Mu 1.0 using micropython 1.9.2.
Re: AttributeError: 'MicroBitI2C' object has no attribute 'scan'
Cool. And thanks so much for the quick reply. I see lots of references to micropython 1.9.2, so I suspected that might be the case.
So, presumably the docs on https://microbit-micropython.readthedocs.io/en/latest/ cover micropython v1.9.2 (or something similar) for microbit.
But https://codewith.mu/en/download has a version of Mu (for Mac OS X at least) that is based on (or defaults to using?) micropython v1.7.9.
So how do I set Mu to used micropython 1.9.2, or do I need to download a different version of Mu from somewhere else? This seems like really basic stuff, so I wonder how beginners are meant to work this out for themselves?
So, presumably the docs on https://microbit-micropython.readthedocs.io/en/latest/ cover micropython v1.9.2 (or something similar) for microbit.
But https://codewith.mu/en/download has a version of Mu (for Mac OS X at least) that is based on (or defaults to using?) micropython v1.7.9.
So how do I set Mu to used micropython 1.9.2, or do I need to download a different version of Mu from somewhere else? This seems like really basic stuff, so I wonder how beginners are meant to work this out for themselves?
Re: AttributeError: 'MicroBitI2C' object has no attribute 'scan'
I think you can get it from https://github.com/mu-editor/mu/releases