Figure 3-6
The Serial Monitor
As
you would expect, there is a built-in function that you can use in your sketches to
send a message back to the Serial Monitor.
It is called
Serial.println
and it expects a
single argument, which consists of the information that you want to send. This information
is usually a variable.
You will use this mechanism to test out a few things that you can do with variables and
arithmetic in C; frankly, it’s the only way you can see the results of your experiments in C.
Numeric Variables and Arithmetic
The last thing you did was add the following line to your blinking sketch to increase the
blinking period steadily:
Looking
closely at this line, it consists of a variable name,
then an equals sign, then
what is called an expression (
delayPeriod + 100
). The equals sign does something called
assignment. That is, it assigns a new value to a variable, and the value it is given is
determined by what comes after the equals sign and before the semicolon. In this case, the
new value to be given to the
Dostları ilə paylaş: