Difference between revisions of "Mixly Block Category - SerialPort"
(→Serial Baud Rate) |
(→Serial Availability) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | Serial is used for communication between the Microduino / Arduino board and a computer or other devices. All Microduino / Arduino boards have at least one serial port (also known as a UART or USART): Serial. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/Serial | ||
=Serial Baud Rate= | =Serial Baud Rate= | ||
Sets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. | Sets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. | ||
Line 6: | Line 10: | ||
=Serial Write= | =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. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/Write | ||
+ | |||
=Serial Print= | =Serial Print= | ||
+ | Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/Print | ||
+ | |||
=Serial PrintLn= | =Serial PrintLn= | ||
+ | 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'). This command takes the same forms as '''print'''. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/Println | ||
+ | |||
=Serial PrintLn(Hex)= | =Serial PrintLn(Hex)= | ||
+ | Prints a number to the serial port as human-readable hex format number. Followed by a carriage return character (ASCII 13, or '\r') and a newline character (ASCII 10, or '\n'). | ||
+ | |||
=Serial Availability= | =Serial Availability= | ||
+ | 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). available() inherits from the Stream utility class. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/Available | ||
+ | |||
=Serial Read String= | =Serial Read String= | ||
+ | Reads characters from the serial buffer into a string. The function terminates if it times out. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/ReadString | ||
=Serial Read String Until Character Delimitation= | =Serial Read String Until Character Delimitation= | ||
+ | Reads characters from the serial buffer into a string. The function terminates if the terminator character is detected or it times out. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/ReadStringUntil | ||
+ | |||
=Serial Read= | =Serial Read= | ||
− | + | ==read== | |
− | + | Reads incoming serial data. | |
− | + | ||
− | + | ||
+ | Read more here: https://www.arduino.cc/en/Serial/Read | ||
+ | ==peek== | ||
+ | Returns the next byte (character) of incoming serial data without removing it from the internal serial buffer. That is, successive calls to '''peek''' will return the same character, as will the next call to '''read'''. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/Peek | ||
+ | ==parseInt== | ||
+ | Looks for the next valid integer in the incoming serial stream. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/ParseInt | ||
+ | |||
+ | ==parseFloat== | ||
+ | '''parseFloat''' returns the first valid floating point number from the Serial buffer. Characters that are not digits (or the minus sign) are skipped. '''parseFloat''' is terminated by the first character that is not a floating point number. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/ParseFloat | ||
=Serial Flush= | =Serial Flush= | ||
+ | Waits for the transmission of outgoing serial data to complete. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Serial/Flush | ||
=Software Serial Setup= | =Software Serial Setup= | ||
+ | Initializes the pins for SoftwareSerial. Starting SoftwareSerial is done with the '''begin''' function block. |
Latest revision as of 00:49, 1 March 2017
Serial is used for communication between the Microduino / Arduino board and a computer or other devices. All Microduino / Arduino boards have at least one serial port (also known as a UART or USART): Serial. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output.
Read more here: https://www.arduino.cc/en/Reference/Serial
Contents
Serial Baud Rate
Sets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200.
Read more here: https://www.arduino.cc/en/serial/begin
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.
Read more here: https://www.arduino.cc/en/Serial/Write
Serial Print
Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character.
Read more here: https://www.arduino.cc/en/Serial/Print
Serial PrintLn
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'). This command takes the same forms as print.
Read more here: https://www.arduino.cc/en/Serial/Println
Serial PrintLn(Hex)
Prints a number to the serial port as human-readable hex format number. Followed by a carriage return character (ASCII 13, or '\r') and a newline character (ASCII 10, or '\n').
Serial Availability
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). available() inherits from the Stream utility class.
Read more here: https://www.arduino.cc/en/Serial/Available
Serial Read String
Reads characters from the serial buffer into a string. The function terminates if it times out.
Read more here: https://www.arduino.cc/en/Serial/ReadString
Serial Read String Until Character Delimitation
Reads characters from the serial buffer into a string. The function terminates if the terminator character is detected or it times out.
Read more here: https://www.arduino.cc/en/Serial/ReadStringUntil
Serial Read
read
Reads incoming serial data.
Read more here: https://www.arduino.cc/en/Serial/Read
peek
Returns the next byte (character) of incoming serial data without removing it from the internal serial buffer. That is, successive calls to peek will return the same character, as will the next call to read.
Read more here: https://www.arduino.cc/en/Serial/Peek
parseInt
Looks for the next valid integer in the incoming serial stream.
Read more here: https://www.arduino.cc/en/Serial/ParseInt
parseFloat
parseFloat returns the first valid floating point number from the Serial buffer. Characters that are not digits (or the minus sign) are skipped. parseFloat is terminated by the first character that is not a floating point number.
Read more here: https://www.arduino.cc/en/Serial/ParseFloat
Serial Flush
Waits for the transmission of outgoing serial data to complete.
Read more here: https://www.arduino.cc/en/Serial/Flush
Software Serial Setup
Initializes the pins for SoftwareSerial. Starting SoftwareSerial is done with the begin function block.