Hackscribble,
Unfortunately no
Still six 255s after first Open() and four 255s after the second one.
Robin2,
Thanks for joinning to the discussion. I considered your proposition. I did two things to test it. But first of all I changed the Arduino's if condition to Serial.available() > 0.
-
To confirm this is a C# issue I used the Arduino's serial monitor tool. I reset the arduino and then launched serial monitor tool and sent the 'A'. Arduino's LCD screen displayed "65-1-1-1-1-1-1". There wasn't any extra 255s.
-
To confirm this is not a String issue i used int[] instead of it:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
//Open Serial Port
Serial.begin(9600);
//Initialize LCD
lcd.begin(16, 2);
}
void loop() {
if (Serial.available() > 0)
{
lcd.clear();
int message[7];
message[0] = Serial.read();
message[1] = Serial.read();
message[2] = Serial.read();
message[3] = Serial.read();
message[4] = Serial.read();
message[5] = Serial.read();
message[6] = Serial.read();
lcd.print(message[0]);
lcd.print(message[1]);
lcd.print(message[2]);
lcd.print(message[3]);
lcd.setCursor(0, 1);
lcd.print(message[4]);
lcd.print(message[5]);
lcd.print(message[6]);
}
delay(1000);
}
Output on Arduino's LCD using:
- C# app: "255255255255255255-1"
- Arduino's Serial Monitor: "65-1-1-1-1-1-1"
Unfortunately this looks like a pure C# issue ![]()