Abstract
The HardwareSerial() is a constractor to create an object to perfome serial communication. In Arduino Uno, an object named ‘Serial’ is generated.
The HardwareSerial class is derived from Stream class. The Stream class is for string based stream. It defines virtual functions like available(), read(), peak() and flush(), they need to be implemented in the derived classes, and find(), findUntil(), parseInt() and so on.
The Stream class is derived from Print class. Print class implements displaying character or strings. The write() function to display a character shuould be implemented in the derived classes, in this case, HardwareSerial class. Then we can use print() and/or println().
The constractor of HardwareSerial initializes member variables.
Source Code
HardwareSerial() is defined in hardware/arduino/avr/cores/arduino/HardwareSerial_private.h as below.
|
|
It initializes member variables using argments.
Version
Arduino AVR Boards 1.8.6
Last Update
March 21, 2023