Hardware Reference
In-Depth Information
The syntax of
Serial.begin()
is:
Serial.begin(speed);
The parameter is:
speed
: the speed in bits per second (also known as baud). The following val-
ues are typically used: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200,
28800, 38400, 57600, or 115200. With Arduino sketches, 9600 is most
common.
Serial.begin()
does not return a value.
Serial.print()
This function transmits data over the serial port.
The syntax of
Serial.print()
is:
Serial.print(value);
The parameter is:
value
: the data to send. This can be a string of text, a character, a byte, an
integer, or other types of data.
Serial.print()
returns the number of bytes transmitted. It's not necessary
to use this return value and you can safely ignore it.
Serial.println()
Just like
Serial.print()
,
Serial.println()
sends data over the serial port.
The difference is that it adds a carriage return to the end of the data it sends.
The syntax of
Serial.println()
is:
Serial.println(value);
The parameter is:
value
: the data to send. This can be a string of text, a character, a byte, an
integer, or other types of data.
Serial.println()
returns the number of bytes transmitted. It's not neces-
sary to use this return value and you can safely ignore it.
Controlling A/C Appliances with Relays
The small amount of electrical current that comes from the digital pins is not
enough to power much more than a small LED. In order to control the power
to something like a lamp or blender, you'll need to use a
relay
.