Skip to content

arduino-cli monitor does not flush characters until \n is typed #2251

Closed
@cshamis

Description

@cshamis

Describe the problem

I was trying to debug my Serial.read() routines and couldn't figure out what I was doing wrong. None of my keypresses were getting through to my program. Then I hit enter ... and they ALL came through.

After much reading about line endings in the terminal (not applicable here) I tried using screen to directly connect to the serial port. Screen sends the characters as they are typed, and my program works fine.

Is the arduino-cli monitor buffering until a newline intentional? Or a bug? Or just not well documented? Or... maybe something else.

To reproduce

void hardwareUART() {
int charIn = Serial.read();
if (charIn == -1) {
return;
}
Serial.print(charIn);
}

Expected behavior

When typing in a bidirectional terminal, characters are sent as typed. Not buffered until newline.

Arduino CLI version

0.33.1

Operating system

macOS

Operating system version

Ventura 13.4

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

type: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions