Arduino LCD仅在底行显示黑框
免责声明:这是家庭作业。
我正在参加 Arduino 课程,对于我们的项目,我们必须实现一个简单的草图。涉及的硬件是 Arduino Mega ADK 板 和 电子程序块入门套件。我已经能够用我的草图成功地与 Arduino 进行通信;除了 LCD 之外,其他东西(如按钮和 LED)似乎都可以工作。我已经遵循了许多教程(包括第二个链接中的 LCD 示例程序),但我无法让任何东西发挥作用。我的液晶显示屏始终在底行显示黑框。环顾四周,我发现当液晶显示屏未正确连接时会出现黑框。然而,这是一个入门套件,其中包含可以连接到机箱的电缆,从而消除了焊接单根电线的麻烦。我的液晶显示器有问题吗?这是一个我无法使用的简单草图:
#include <LiquidCrystal.h>
LiquidCrystal lcd(10,11,12,13,14,15,16);
void setup()
{
Serial.begin( 9600 );
lcd.begin(16, 2);
lcd.clear();
}
void loop()
{
lcd.setCursor(0,0);
lcd.println( "hello world! ");
delay(1000);
}
引脚对应于 BUS2,并且我已将电缆从 BUS2 正确连接到 LCD。
Disclaimer: This is homework.
I'm taking an Arduino class and for our project we have to implement a simple sketch. The hardware involved is the Arduino Mega ADK board and the Electronic Brick Starter Kit. I have been able to successfully communicate with the Arduino with my sketches; other things (like the push-button, and LED's) seem to work, except for the LCD. I've followed numerous tutorials (including the on sample program for LCD's in my second link), but I can't get anything to work. My LCD consistently shows black boxes in the bottom line. From looking around, I see that black boxes show up when the LCD isn't connected properly. However, this is a starter kit which contains cables that you can hook up to a chassis, which gets rid of the pain involved in soldering individual wires. Is there something wrong with my LCD? Here's a simple sketch that I'm unable to get to work:
#include <LiquidCrystal.h>
LiquidCrystal lcd(10,11,12,13,14,15,16);
void setup()
{
Serial.begin( 9600 );
lcd.begin(16, 2);
lcd.clear();
}
void loop()
{
lcd.setCursor(0,0);
lcd.println( "hello world! ");
delay(1000);
}
The pins correspond to BUS2 and I've properly hooked up my cable from BUS2 to the LCD.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
我有类似的问题。使用最少数量的引脚连接 LCD:
LiquidCrystal(rs, enable, d4, d5, d6, d7)
。我遇到的问题是我没有将 lcd 的 R/W(读/写)引脚连接到 GND。当我这样做时 - 它已经开始起作用了。我还发现在Vo
(对比度调整)和 GND 之间添加一个 3.3k 电阻很有用,这样可以轻松阅读文本。I had similar problem. Was connecting the LCD using minimum number of pins:
LiquidCrystal(rs, enable, d4, d5, d6, d7)
. The problem I had is that I didn't connectR/W
(Read/Write) pin of the lcd to GND. When I did this - it has started to work. Also I found useful to add a 3.3k resistor fromVo
(Contrast Adj) to GND so the text can be read easily.请确保所有接头引脚都已正确焊接在 LCD 上。
如果您使用排针而不焊接在 LCD 的 16 个孔中
移动 LCD 直到找到稳定的测试位置。
很容易,并不是所有人都在联系
这个基本的 helloworld 示例应该可以工作
http://www.arduino.cc/en/Tutorial/LiquidCrystal
用于测试推负载在 arduino IDE 中用于上传脚本。
arduino板上的重置按钮有时无法初始化LCD
Please ensure that you have all your header pins soldered ok in the LCD.
If you are using header pins without soldering in the 16 holes of you LCD
move your LCD until you find a stable position for testing.
Its easy that not all of them are contacting
This basic helloworld example should work
http://www.arduino.cc/en/Tutorial/LiquidCrystal
For testing push load in the arduino IDE for uploading the script.
Reset button in the arduino board sometimes is no initializing the LCD
您应该检查您的 LiquidCrystal lcd()。遇到了同样的问题,我对此进行了调整,现在它可以工作了。
You should check your LiquidCrystal lcd(). Got the same problem and i adjusted this and now it works.
对于预制的液晶板,尚不清楚您可以进行哪些调整。
但是,如果 LCD 显示与您正在写入的内容相对应的黑框(例如,如果您写了“hello world!”,并且您看到每个字符和空格有 12 个黑框,则 LCD 电压可能过高。如果您没有任何方法来调整 LCD 的电压,那么也许可以使用 arduino 的较低电压电源(以防您的 LCD 获得输入电压,而不是调整后的 5V 电源。
With that pre-build lcd board, its not clear what adjustments you have available to you.
But if the LCD shows black boxes that correspond to what you are writing to it (like if you wrote "hello world!", and you see 12 black boxes for each character and space, then its possible that the LCD voltage is too high. If you don't have any way to adjust the voltage to the LCD, then perhaps using a lower voltage power supply to the arduino (in case your LCD is getting the input voltage, and not the adjusted 5V supply.
下一行的黑框通常表示 LCD 未收到所需的初始化命令。原因可能是接线错误 - 命令进入涅槃状态,但不进入 LCD。
因此,您应该
仔细检查板上的每个开关、防护罩和 LCD 模块本身 - 它们是否处于正确的状态?
仔细检查,确保正确的草图确实在 Arduino 上。
在
lcd.begin(...)
之前插入一个delay(1000);
- 也许 LCD 需要更多时间来启动如果这是这个作业,那么你可以在朋友的或其他设备上测试您的 LCD老师的 Arduino。
您的液晶显示屏可能坏了。但是错误初始化的问题在这个网站和其他论坛上经常出现,因此概率表明它是好的。
Black boxes in the lower line usually indicate, that the LCD did not receive the required initialisation commands. Causes may be wrong cabling - the commands go to nirvana but not to the LCD.
So you should
double check every switch on the board, the shield and the LCD module itself - are they in the right state?
double check, that the right sketch is actually on the Arduino.
Insert a
delay(1000);
just beforelcd.begin(...)
- Perhaps the LCD needs some more time for startupIf this this homework, then you can test your LCD on a mate's or the teacher's Arduino.
Your LCD might be bad. But the problem of wrong initialisation comes up so often on this site and on other forums, that the probability indicates it is OK.
您需要逐步解决问题。例如:
通过在朋友的运行良好的硬件上运行您的草图来测试您的草图是否有效。如果您的草图有效,那么您就知道问题出在您的硬件中,如果失败,则问题出在您的软件(草图)中。
如果问题出在硬件上:将您的可疑液晶屏更换为朋友的工作正常的液晶屏。如果它现在可以工作,那么您就知道您的液晶显示屏坏了。
如果更换液晶显示屏没有帮助,则更换主板。最终,如果您从一个可疑系统(也称为被测系统)和一个已知良好的系统(也称为“黄金系统”)开始,那么您应该能够分辨出哪些部分被测系统的哪些工作正常,哪些不工作。
其他评论
找出问题所在的整个练习本身就是一项值得进行的练习。请务必仔细记录您正在尝试的内容。写下你的笔记对于处于你困境的其他人来说可能是一个有价值的文档。
良好的实验设置还应仔细包括用于诊断问题的已知良好(黄金)系统。
每个可交换单元(也称为 FRU 或现场可更换单元)都需要一个良好的标签。该标签用于确保您不会混淆优质 FRU 和可疑 FRU。由于它们在各方面都相同(除了一个可以工作,另一个可能无法工作),因此很容易将它们混淆。
将已知良好的 FRU 更换为可疑的 FRU 时要小心:如果合适,请采取防静电预防措施。将系统正确接地。确保所有连接均正确。
You need to do step-wise problem solving. For example:
Test that your sketch works by running your sketch on a friend's hardware that is working well for him. If your sketch works then you know that the problem is in your hardware if it fails then the problem is in your software (sketch).
If the problem is hardware: swap your suspect lcd with a friend's that is working correctly. If it now works then you know that your lcd is bad.
If swapping lcd's doesn't help then swap main boards. Eventually, if you start with a suspect system (also know as the System Under Test) and with a known-good system (also called a "Gold System") then you should be able to tell which parts of the System Under Test are working and which aren't.
Additional comments
This entire exercise of figuring out what is wrong is, itself, a worthy exercise. Be sure to keep careful notes of what you are trying. Writing up your notes can be a valuable document for others in your predicament.
A good experimental setup would also carefully include a known-good (gold) system for use in diagnosing issues.
Each swappable unit (also known as a FRU or Field Replacable Unit) needs a good label. The label is used to make sure that you don't get the good and suspect FRUs mixed up. Since they are identical in every way (except one works and the other may or may not) it is easy to get them mixed up.
Be careful when swapping a known-good for a suspect FRU: if appropriate use anti-static precautions. Ground the systems correctly. Make sure that all connections are correct.
我尝试了你的代码,除了 LCD 声明“LiquidCrystal lcd(10,11,12,13,14,15,16);”
草图开始工作,并且 LCD 上显示消息。
我的设备是:
我怀疑您的 LCD 声明部分有问题。我的代码如下(来自“LiquidCrystal”中“hello world”的arduino示例:
如您所知,上述声明中的引脚连接是:
我是 Arduino 世界的新手,只是想表达一下我对 Arduino 体验的惊讶,如果您仍有问题,请告诉我。
I tried your code except the LCD declaration "LiquidCrystal lcd(10,11,12,13,14,15,16);"
The sketch works and the LCD shows the message.
My devices are:
I suspect something in trouble in your LCD declaration section. My code is as follows(from the arduino example of "hello world" in the "LiquidCrystal":
As you understand, the pin connections in the above declaration are:
I'm a newbie for Arduino world. Just trying to communicate the amazement I'm feeling about Arduino experience. Please inform me if you still have some problems.
我有同样的问题。我通过电缆重新测试,发现有两根坏线。更改这些后我仍然遇到同样的问题。下一步,我将引脚条焊接到 LCD 上。我看过很多关于这方面的帖子,并认为我更了解。好吧,将引脚条焊接到 LCD 上后,神奇!如果您仔细遵循别人的步骤,一切都会顺利。
I had the same issue. I retested by cables to find two bad wires. After changing these I still had the same issue. Next step, I solder the pins strip to the LCD. I had seen many posts on this and thought I knew better. Well, after welding the pins strip to the LCD, MAGIC! All goes well if you follow the steps of others carefully.
这可能是由于液晶显示器的接线或对比度调节引脚不良造成的,只需在对比度引脚上连接一个可变电阻并调节对比度,这可能会解决您的问题。
Its either due to bad wiring or contrast adjustment pin of the LCD ,just connect a variable resistance at the contrast pin and adjust your contrast and this may solve your problem.