Serial
- Print format
Prints data to the serial port as human-readable ASCII text.
Format: specifies the number base (for integral data types) or number of decimal places (for floating point types)
Example: reads an analog input on analog in 0, prints the value out.
- Serial read
Reads incoming serial data.
Returns the first byte of incoming serial data available (or -1 if no data is available) – int
Serial available:
Get the number of bytes (characters) available for reading from the serial port. This is data that’s already arrived and stored in the serial receive buffer (which holds 64 bytes).
Print on new line:
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or ‘\r’) and a newline character (ASCII 10, or ‘\n’). To view the output text, the serial baud rate should be set to 9600. This is a choice of TUNIOT to make thing easier.
Example: Showing the value of the photo-resistor on the serial monitor Video
Serial Write:
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.
Serial write (return):
Will return the number of bytes written, though reading that number is optional.
Return BYTE.
Serial Flush:
Waits for the transmission of outgoing serial data to complete.