NodeMCU Projects: Difference between revisions
Content added Content deleted
Line 369: | Line 369: | ||
morse("amandeep") |
morse("amandeep") |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
= I2C LCD = |
|||
https://forum.micropython.org/viewtopic.php?f=16&t=2858 |
|||
https://forum.micropython.org/viewtopic.php?f=16&t=2858&start=30 |
|||
https://github.com/dhylands/python_lcd/tree/master/lcd |
|||
esp8266_i2c_lcd.py |
|||
lcd_api.py |
|||
D1 SCL ------------ SCL |
|||
D2 SDA ------------ SDA |
|||
GND --------------- GND |
|||
5V ---------------- VCC |
|||
There are two versions of this device - the difference is the controller IC. |
|||
If you have the PCF8574T. the default I2C bus address is 0x27. |
|||
If you have the PCF8574AT the default I2C bus address is 0x3F. |
|||
An i2c.scan() should reveal which address to use |
|||
lcd=I2cLcd(i2c, 0x27, 2, 16) |
|||
lcd=I2cLcd(i2c, 39, 2, 16) |
|||
<syntaxhighlight lang="python"> |
|||
>>> from machine import I2C |
|||
>>> i2c = I2C(scl=Pin(5), sda=Pin(4), freq=400000) |
|||
>>> print(i2c.scan()) |
|||
>>> print(i2c.scan()) |
|||
[63] |
|||
>>> lcd=I2cLcd(i2c, 63, 2, 16) |
|||
</syntaxhighlight> |
|||
<br /> |
<br /> |