Bluetooth Arduino无法在loop()函数中写入lcd屏幕
当我收到串行数据时,我试图在lcd屏幕上打印东西。它的工作原理如下:Bluetooth Arduino无法在loop()函数中写入lcd屏幕,bluetooth,arduino,serial-port,arduino-uno,lcd,Bluetooth,Arduino,Serial Port,Arduino Uno,Lcd,当我收到串行数据时,我试图在lcd屏幕上打印东西。它的工作原理如下: void setup() { // put your setup code here, to run once: lcd.begin(16, 2); lcd.write("hello"); } void loop() { if (Serial.available() == 5) { inputByte_0 = Serial.read(); delay(10);
void setup() {
// put your setup code here, to run once:
lcd.begin(16, 2);
lcd.write("hello");
}
void loop() {
if (Serial.available() == 5) {
inputByte_0 = Serial.read();
delay(10);
inputByte_1 = Serial.read();
delay(10);
inputByte_2 = Serial.read();
delay(10);
inputByte_3 = Serial.read();
delay(10);
inputByte_4 = Serial.read();
}
if (inputByte_0 == 9) {
Serial.println("hi");
lcd.write("whats up?");
}
}
开始时写“你好”。当我发送正确的字节时,它会向我发送消息“hi”,但它不会在屏幕上写入任何内容。我做错了什么?谢谢 我会尝试使用lcd.print(“String”)而不是lcd.write,看看这是否有效不要使用lcd.write()函数在lcd上打印字符串。而是使用功能lcd.print(“您的字符串”) lcd.write和lcd.print属于同一个类liquidcystal,但唯一的区别是print函数将参数转换为字符串,而write()函数则不会 考虑使用lcd.print()