Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
833 views
in Technique[技术] by (71.8m points)

arduino - How can I use a shift register with an LCD(16,2)

I am experiencing a problem in using a shift register with an LCD for a project that requires a lot of GPIO pins on the Arduino Nano.

Here is the example code:

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

And here is the error message:

no matching function for call to 'LiquidCrystal::LiquidCrystal(int)'

I have reinstalled the Arduino IDE, libraries and deleted all past personal sketches but nothing seems to work. I am quite new to Arduino so I my only assumption is that something is going wrong with the library.

question from:https://stackoverflow.com/questions/65643922/how-can-i-use-a-shift-register-with-an-lcd16-2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

the reason this is happening is because you included a development version of the ShiftedLCD library. Rather than installing the development version from the Github repository, download the suggested stable version.

Screenshot of working library


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...