使文本显示在I2C LCD上 [英] Getting text to show up on an I2C LCD

查看:80
本文介绍了使文本显示在I2C LCD上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是电子产品的新手,因此尝试使我的1602 LCD与I2C适配器一起使用.我可以使用背光,但是无法显示文字.这是我当前的代码:

I am new to electronics, and trying to get my 1602 LCD to work with an I2C adapter. I got my backlight to work, but I can't get text to show. This is my current code:

#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);
}

我用扫描器检查了I2C地址,它是0x27.

I checked for the I2C address with the scanner and it is 0x27.

我用Google搜索了一下,然后通过了帖子,其中有人发布了此帖子:

I Googled a bit and came past this post where someone posted this:

简单测试

在LCD显示屏上施加+ 5v/GND,然后在LCD模块上施加背景LED电源(有时标记为A/K).

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.

当然,现在您知道您基本上需要三个电源".与LCD的连接-LCD本身,对比度和背光.

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

可以肯定的是,由于缺少主要的LCD电源-因此无法处理/显示任何智能数据.

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

我也进行了此测试,并得出了这些结果:

I did this test aswell and came to these results:

  • 向背光灯提供5V电压时,它会变亮.
  • 当同时向背光灯和LCD本身提供5V电压时,背光灯会变暗,但没有其他显示.

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

I then accidentally put the I2C adapter upside down, but that did give me the text blocks.

如何显示文字?我目前在做什么错了?

How could I get the text to show? What am I currently doing wrong?

推荐答案

次要问题,您是否尝试过修剪锅底?我怀疑这会设置对比度,而我忘记了这一点,并且显示空白.您的西蒙M.

Minor point, have you tried trimming the pot? I suspect that this sets the contrast, and I forgot this and I had a blank display. Yours Simon M.

这篇关于使文本显示在I2C LCD上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆