让文本显示在 I2C LCD 上

Getting text to show up on an I2C LCD

我是电子学新手,正在尝试让我的 1602 LCD 与 I2C 适配器配合使用。 我的背光灯可以工作,但无法显示文字。 这是我当前的代码:

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
    lcd.init();
    lcd.backlight();
    lcd.setCursor(5, 0);
    lcd.print("HELLO");
}

void loop() {
    lcd.backlight();
    delay(2000);
    lcd.noBacklight();
    delay(2000);
}

我用 scanner 检查了 I2C 地址,它是 0x27。

我在谷歌上搜索了一下,发现 this post 有人 post 编辑了这个:

Simple test

Apply +5v / GND to LCD - display - and than apply background LED power ( sometime marked A/K) to the LCD module.

No other connections ( data etc.) are necessary for this power up test.

You should be able to discern ALL chatterers fields, but connecting contrast pot will make it easier.

It MAY not be totally visible but the module will initialize ( internally) on power up and ALL characters fields should show.

Of course by now you know you need basically three "power" connections to the LCD - LCD itself, contrast and backlight.

Sure looks as the main LCD power is missing - hence no intelligent data can be processed / displayed.

我也做了这个测试,结果是these results:

然后我不小心将 I2C 适配器倒置,但这确实给了我文本块。

我怎样才能让文字显示出来?我现在做错了什么?

您的 I2C 适配器将串行数据转换为并行输出到 LCD 引脚。 您确定这是针对您期望的引脚完成的吗?

特别是如果您将 any I2C 适配器与 any 16 针 LCD 模块混合使用,您应该检查将哪些信号放在哪里...

如果需要,有 LiquidCrystal_I2C 个构造函数,您可以在其中指定 LCD 引脚(如果默认值不适合)。

小问题,你试过切锅吗?我怀疑这会设置对比度,但我忘记了这一点,而且我的显示器是空白的。 你的 Simon M.