如何在 LCD 上使用移位寄存器(16,2)
How can I use a shift register with an LCD(16,2)
我在将带 LCD 的移位寄存器用于需要 Arduino Nano 上大量 GPIO 引脚的项目时遇到问题。
示例代码如下:
// include the library code:
#include <ShiftedLCD.h>
#include <SPI.h>
// initialize the library with the number of the sspin
// (or the latch pin of the 74HC595)
LiquidCrystal lcd(8);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}
这是错误消息:
no matching function for call to 'LiquidCrystal::LiquidCrystal(int)'
我已经重新安装了 Arduino IDE、库并删除了所有过去的个人草图,但似乎没有任何效果。我对 Arduino 很陌生,所以我唯一的假设是图书馆出了问题。
发生这种情况的原因是您包含了 ShiftedLCD
库的开发版本。不要从 Github 存储库安装开发版本,而是下载 suggested stable version.
我在将带 LCD 的移位寄存器用于需要 Arduino Nano 上大量 GPIO 引脚的项目时遇到问题。
示例代码如下:
// include the library code:
#include <ShiftedLCD.h>
#include <SPI.h>
// initialize the library with the number of the sspin
// (or the latch pin of the 74HC595)
LiquidCrystal lcd(8);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}
这是错误消息:
no matching function for call to 'LiquidCrystal::LiquidCrystal(int)'
我已经重新安装了 Arduino IDE、库并删除了所有过去的个人草图,但似乎没有任何效果。我对 Arduino 很陌生,所以我唯一的假设是图书馆出了问题。
发生这种情况的原因是您包含了 ShiftedLCD
库的开发版本。不要从 Github 存储库安装开发版本,而是下载 suggested stable version.