我非常困惑,我制作一个Android应用程序来控制伺服并发送android应用程序的文本并出现在lcd 16 x 2中。 但如何使Android应用程序的伺服控制中的数据不会出现在液晶屏lcd 16 x 2上,因为它只用于显示从Android应用程序发送的文本,这里我使用HC05蓝牙模块进行连接。
我已经添加了代码
lcd.clear (); // is not working
lcd.write ( 'c'); //not successful
此代码
#include <Servo.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
Servo myservo1, myservo2, myservo3;
LiquidCrystal lcd (7, 6, 5, 4, 3, 2);
String readString;
int bluetoothTx = 0;
int bluetoothRx = 1;
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup() {
Serial.begin(9600);
bluetooth.begin(9600);
//setup lcd
lcd.begin(16, 2);
lcd.clear();
lcd.noAutoscroll();
lcd.print("Parking Stand 1");
delay(200);
//setup servo
//myservo3.attach(10);
//myservo2.attach(9);
myservo3.attach(8);
}
//SERVO CODE
void loop() {
if(bluetooth.available()> 1 ) {
int servopos = bluetooth.read();
Serial.println(servopos);
//myservo1.write(servopos);
//myservo2.write(servopos);
myservo3.write(servopos);
//lcd.clear();//is not working
//lcd.write('c');//is not working
}
//LCD CODE
while (Serial.available()) {
delay (3);
char c = Serial.read();
readString += c;
}
if (readString.length() >0) {
lcd.clear();
Serial.println(readString);
lcd.print(readString);
readString="";
}
}
请帮助增强上面的程序代码。提前致谢