Serial.Write History

Hide minor edits - Show changes to markup

January 30, 2012, at 05:11 PM by Scott Fitzgerald -
Changed line 46 from:
to:
January 30, 2012, at 05:10 PM by Scott Fitzgerald -
Changed lines 46-48 from:
to:
October 31, 2011, at 02:44 PM by Tom Igoe -
Changed line 32 from:

[@

to:
Changed lines 42-44 from:

@]

to:
October 30, 2011, at 07:10 PM by Scott Fitzgerald -
Added lines 27-44:

Returns

byte
write() will return the number of bytes written, though reading that number is optional

Example

void setup(){
  Serial.begin(9600);
}

void loop(){
  Serial.write(45);	// send a byte with the value 45

   int bytesSent = Serial.write(“hello”); //send the string “hello” and return the length of the string.
}

February 01, 2010, at 05:25 PM by David A. Mellis -
Changed lines 15-16 from:

Arduino Mega also supports: Serial1, Serial2, Serial3

to:

Arduino Mega also supports: Serial1, Serial2, Serial3 (in place of Serial)

February 01, 2010, at 05:24 PM by David A. Mellis -
Changed lines 15-16 from:

Arduino Mega also supports: Serial1, Serial2, Serial3 instead of Serial.

to:

Arduino Mega also supports: Serial1, Serial2, Serial3

February 01, 2010, at 05:24 PM by David A. Mellis -
Changed lines 1-2 from:

Serial.write()

to:

Serial

write()

February 01, 2010, at 05:23 PM by David A. Mellis -
Changed lines 9-12 from:

serial.write(val)
serial.write(str)
serial.write(buf, len)

to:

Serial.write(val)
Serial.write(str)
Serial.write(buf, len)

Arduino Mega also supports: Serial1, Serial2, Serial3 instead of Serial.

June 05, 2009, at 05:44 PM by David A. Mellis -
Added lines 1-26:

Serial.write()

Description

Writes binary data to the serial port. This data is sent as a byte or series of bytes; to send the characters representing the digits of a number use the print() function instead.

Syntax

serial.write(val)
serial.write(str)
serial.write(buf, len)

Parameters

val: a value to send as a single byte

str: a string to send as a series of bytes

buf: an array to send as a series of bytes

len: the length of the buffer

See also

Share