[英]no matching function for call to 'LiquidCrystal::write(String&)'
void printOnLcd(String s){
for (int i =0; i<2; i++){
if( i % 2 == 0){
for(int a=0; a<16; a++){
lcd.setCursor(a,i);
lcd.write(s);
delay(200);
lcd.setCursor(a,i);
lcd.write(" ");
}
} else {
for(int a = 0; a<16; a++){
lcd.setCursor(a,i);
lcd.write(s);
delay(200);
lcd.setCursor(a,i);
lcd.write(" ");
}
}
}
Arduino gives me the problem: no matching function for call to 'LiquidCrystal::write(String&)' Can't I put a string on the screen? Arduino 给了我一个问题:没有匹配的 function 调用 'LiquidCrystal::write(String&)' 我不能在屏幕上放一个字符串吗? what's the problem?有什么问题? I encountered this problem a few days ago and now I don't have a chance to look for a possible solution.几天前我遇到了这个问题,现在我没有机会寻找可能的解决方案。
now I don't have a chance to look for a possible solution.现在我没有机会寻找可能的解决方案。
Open a webbrowser, enter www.google.com , enter "Arduino LiquidCrystal", click the first hit:打开浏览器,输入www.google.com ,输入“Arduino LiquidCrystal”,点击第一个点击:
https://www.arduino.cc/en/Reference/LiquidCrystal < the Arduino manual btw. https://www.arduino.cc/en/Reference/LiquidCrystal < Arduino 手册顺便说一句。 Read it!阅读!
You're trying to use LiquidCrystal.write, so click write and read.您正在尝试使用 LiquidCrystal.write,因此请单击写入和读取。
Syntax句法
lcd.write(data) lcd.write(数据)
data: the character to write to the display数据:要写入显示器的字符
So obviously you can only use this function to print a single character.所以显然你只能使用这个 function 来打印单个字符。
Now check wether there is another function that allows you to write a string.现在检查是否还有另一个 function 允许您编写字符串。
The next function in the list is print列表中的下一个 function 是print
Sounds good, let's click that and read.听起来不错,让我们点击阅读。
Syntax句法
lcd.print(data) data: the data to print (char, byte, int, long, or string ) lcd.print(data) data:要打印的数据(char、byte、int、long 或string )
Hey this allows us to display a string!嘿,这允许我们显示一个字符串!
Try it out lcd.print(s);
试试lcd.print(s);
Alternatively click any of the many examples.或者单击许多示例中的任何一个。 Most of them use print.他们中的大多数使用打印。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.