Sorunome / arduino-upload

Atom Package for those who don't like the Arduino IDE
https://atom.io/packages/arduino-upload
MIT License
34 stars 7 forks source link

Weird unexpected newline in serial monitor #88

Open Boba0514 opened 3 years ago

Boba0514 commented 3 years ago

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));
    }