Answer the question
In order to leave comments, you need to log in
How to send message from openHab to Arduino serial COM port?
Hello everyone, I have such a question, I use the openhab.serial.binding addon to receive information from the Arduino serial COM port, it works for me, but to send a message to the Arduino and read it, it doesn’t work.
I tried different methods and examples that I found for this, maybe openHab is not sending messages correctly? Has anyone experienced this?
Answer the question
In order to leave comments, you need to log in
Issue resolved! Here's what I did:
1. Changed the encoding of the link
2. Used this code to read lines from the serial COM port:
String readString;
void setup() {
Serial.begin(9600);
Serial.println("serial test 0021"); // so I can keep track of what is loaded
}
void loop() {
while(Serial.available()) {
delay(10);
char c = (char)Serial.read();
readString += c;
}
if (readString.length() > 0) {
Serial.println(readString);
readString="";
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question