Serial Library

From Public Wiki
Revision as of 22:43, 17 November 2020 by Legg (talk | contribs) (Created page with "==Functions== ===read()=== Serial.read() returns an unsigned byte by assignment. ===write()=== Serial.write() returns a size_t of the number of bytes written. ====write(byte...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Functions

read()

Serial.read() returns an unsigned byte by assignment.

write()

Serial.write() returns a size_t of the number of bytes written.

write(byte val)

This writes a binary 8-bit val.

write(byte array[])

This writes the contents of the array as 8-bit binary until the NULL terminator is found (C String)

write(byte array[], size_t len)

This writes len-number binary bytes from array

print()

Serial.print() creates ASCII/human readable text, from any datatype, depending on type. This is not guaranteed to display binary. Defaults to DEC unless specified explicitly (BIN, OCT, DEC, HEX).

print(byte)

This transforms the byte into a string of decimal digits and then writes them over serial.

print(short|int|long|float)

This transforms these respective data types into a string of human readable numbers that are then sent over serial.

print(byte, HEX)

This transforms the byte into either a one or two character string of 0-9, A-F and writes these to the serial.

print(int array[])

This prints strings of decimal values, without whitespace, to the serial

print(char array[])

This prints a string as symbols without checking that they are printable (can be binary too)

println()

Passes identical parameters to print() and then prints a CR/NL to the serial.