Send buffered data to serial port
Send buffered data to the specified serial port. For more information, see Use Serial Communications with Arduino Hardware.
The Arduino Uno hardware has one serial port device, serial port 0, connected to the digital pins marked TX 1 and RX 0. If you set the Port number parameter to 0, this block transmits over the digital pin marked TX 1.
The block input accepts vector or scalar uint8 data. To convert a data source to uint8, use a Data Type Conversion block.
If you run a simulation of a model that contains this block without the target hardware, this block does nothing. See Block Produces Zeros or Does Nothing in Simulation.
If you use this block in models with the Standard Servo Read, Standard Servo Write, and Continuous Servo Write blocks, use longer sample times to avoid overruns.
Warning Only connect serial port pins to devices that use 5 Volt TTL logic. Do not connect these pins to an RS-232 serial interface, such as the DE-9M connector on a computer, without limiting the voltage. The RS-232 standard allows higher voltages that can damage your hardware. For details, read the documentation for your Arduino hardware.
Enter the number of the serial port.
If you set the Target hardware parameter to:
Arduino Mega 2560, enter a port number from 0 to 3.
Arduino Uno, enter 0.
Arduino Nano, enter 0.
You can assign a Serial Transmit block and a Serial Receive block to the same serial port.
Do not assign multiple Serial Transmit blocks to the same serial port.
Do not assign the pin numbers used by the serial port to other blocks within the model.
Serial port 0 is connected to the USB port through a converter. Do not use both serial port 0 and the USB port at the same time. For example, do not use serial port 0 if you intend to use External mode, because External mode requires the USB port.