mcauser/micropython-mcp23017

AttributeError: 'module' object has no attribute 'MCP23017'

Closed this issue · 4 comments

Hi,

I try this library. But i have this error.

>>> from machine import Pin, I2C
>>> import mcp23017
>>> i2c= I2C(scl=pin(5), sda=Pin(4))
>>> mcp = mcp23017.MCP23017(i2c, 0x20)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'MCP23017'

Are you sure mcp23017.py copied across successfully?
Which board are you using?

I'm using ESP8266 board. (NodeMCU Lolin Board)
sometimes i get this :

MicroPython v1.11-8-g48dcbbe60 on 2019-05-29; ESP module with ESP8266
Type "help()" for more information.
>>> from machine import Pin, I2C
>>> import mcp23017
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError:
>>>  

Files are below:

mpfs [/]> ls

Remote files in '/':

       boot.py
       mcp23017.py
       rotary.py

It’s a pretty big file. Not optimised to run on an ESP8266. I have it working on an ESP32.

May have to compile it into the firmware or make a cut down version to fit on an ESP8266.

Thank for help. I will try