The result of this code adds a newline in the serial monitor after the fifth line. It still happens if I cast it to uint8_t, or if I change data[0] to for example 243 instead, but it doesn't happen anymore if I do both (cast before converting to string and change data[0] to 243). The newline doesn't occur if I look at the same code in the Arduino IDE's serial monitor.
char data[6];
for (int i = 0; i < 6; ++i) {
data[i] = 0;
}
data[0] = 'a'; // 243;
data[1] = 'a';
data[2] = 1;
data[3] = 0;
data[4] = 77;
data[5] = 77;
for (int i = 0; i < 6; ++i) {
Serial.println(String(/*(uint8_t)*/data[i], BIN));
}
The result of this code adds a newline in the serial monitor after the fifth line. It still happens if I cast it to
uint8_t
, or if I changedata[0]
to for example243
instead, but it doesn't happen anymore if I do both (cast before converting tostring
and changedata[0]
to243
). The newline doesn't occur if I look at the same code in the Arduino IDE's serial monitor.