how to import esp8266_i2c_lcd.py

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
icenov
Posts: 9
Joined: Sun Mar 12, 2017 1:27 am

how to import esp8266_i2c_lcd.py

Post by icenov » Thu Apr 06, 2017 11:53 am

I've just received my huzzah feather esp8266 board and managed to connect through Arduino and now mpfshell. I can connect through web socket and load files, or run simple python scripts directly from the >>> prompt. But I am trying to run Dave Hyland's I2C LCD https://github.com/dhylands/python_lcd/ ... cd_test.py without success. The issue is loading the module:
from esp8266_i2c_lcd import I2cLcd
I don't know where this module should be to get loaded from. For normal python scripts (on my desktop), the modules are installed in the correct directory via pip or apt install (linux). But where should the module be for python running on the esp2866? I have tried to put it in the same directory as boot.py on the chip but that also didn't work.
Can anyone clarify? I'm sure it is straightforward, but ...

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: how to import esp8266_i2c_lcd.py

Post by devnull » Thu Apr 06, 2017 12:39 pm

You should put the library in the /lib folder.

But on different devices / builds the system rootpath is different, on the esp8277 version 1.8.7 this folder is in the root i.e:

Code: Select all

/lib
On later builds and on other devices such as pyboard, the system rootpath is /flash

so in that case it would be :

Code: Select all

/flash/lib
If the lib folder does not exist you can create it.

If you want to see which folders are in the search path:

Code: Select all

import sys
sys.path
>> ['', '/lib', '/']

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: how to import esp8266_i2c_lcd.py

Post by dhylands » Thu Apr 06, 2017 4:30 pm

You also need to copy the lcd_api.py file to the device.

Post Reply