Skip to content

Serial.write(buf, Len) always returns 0 #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NickWaterton opened this issue Apr 27, 2016 · 1 comment
Closed

Serial.write(buf, Len) always returns 0 #138

NickWaterton opened this issue Apr 27, 2016 · 1 comment

Comments

@NickWaterton
Copy link

NickWaterton commented Apr 27, 2016

This function is supposed to return the actual number of bytes written. On the USB (native) port it always returns 0.

@NickWaterton NickWaterton changed the title Serial.write(but, Len) always returns 0 Serial.write(buf, Len) always returns 0 Apr 27, 2016
@sandeepmistry
Copy link
Contributor

Hi @NickWaterton,

I can confirm this behaviour with the following sketch:

void setup() {
  SerialUSB.begin(9600);

  while(!SerialUSB);
}

void loop() {
  int written = SerialUSB.println("hello");

  SerialUSB.println(written);

  delay(1000);
}

It prints:

hello
0

instead of:

hello
7

I've submitted #143 to resolve this. You can try it out by following these instructions: #143 (comment)

@agdl agdl closed this as completed in #143 Jun 6, 2016
@sandeepmistry sandeepmistry added this to the Release 1.6.7 milestone Jul 19, 2016
boseji pushed a commit to go-ut/combined-ArduinoCore-samd that referenced this issue May 30, 2020
fix incorrect midi descriptor template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants