micropython-Chinese-Community / mpy-lib

HTS221, LPS22, LIS2DW12, LIS2MDL, LSM6DSO, STTS751, si7051, bme280, bmp280, APDS9930, TM1650, TM1637, LCD1602, GNSS, all kinds of micropython drives, examples, libs
MIT License
170 stars 73 forks source link

Line 36 in lib calls time.sleep_ms, but imports as "from time import sleep_ms" #5

Closed AndyThirtover closed 3 years ago

AndyThirtover commented 3 years ago

Line 36 of mp_i2c_lcd1602.py gives an error of time not defined.

Since Micropython 1.13, it would be better for line 10 to read: from utime import sleep_ms

and line 36: sleep_ms(1)

test.py could have a better I2C definition, for example

i2c = I2C(0, scl=Pin(22), sda=(Pin(21), freq=400000) LCD = LCD1602(i2c, addr=39)

This is how I got this working.

shaoziyang commented 3 years ago

Thanks.