H Exclusive: Softwareserial
| Feature | Hardware Serial (UART) | SoftwareSerial | |---------|------------------------|----------------| | CPU load | ~0% (DMA/hardware shift register) | High (50–90%) | | Simultaneous TX/RX | Full duplex | Half duplex | | Max baud rate | >2 Mbps (board dependent) | 38400 bps (reliable) | | Buffer size | 64–256 bytes (hardware FIFO) | 64 bytes (software) | | Number of ports | Limited (1–4 on AVR) | Unlimited (any pins) | | Interrupt safe | Yes (non-blocking ISR) | No (disables interrupts) |
// Create a SoftwareSerial object SoftwareSerial mySerial(RX_PIN, TX_PIN); softwareserial h
SoftwareSerial is a library for Arduino that allows for serial communication using software to emulate a serial port. This is useful when you need more than one serial connection, but your board only has one or two hardware serial ports available. | Feature | Hardware Serial (UART) | SoftwareSerial