Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bluetooth Arduino无法在loop()函数中写入lcd屏幕_Bluetooth_Arduino_Serial Port_Arduino Uno_Lcd - Fatal编程技术网

Bluetooth Arduino无法在loop()函数中写入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);

当我收到串行数据时,我试图在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);    
        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()