Week 1-2
The Arduino C Language
1. Introduction
In
this lecture, the fundamentals of the
Arduino C language are introduced. The important contents in this
lecture are
data types, operators, the ‘for’ loop, the ‘while’ loop, the ‘if’
statement,
and the ‘switch’ statement’.
2. The Code and the Results
Figure
1: An example of the ‘switch’ statement.
In
Figure 1, an example of the ‘switch’ statement is presented. The 'switch' statement works in the following
way: the
'switch (i)' line detects the value of 'i' and enters the specific case
directly
and then run all the rest of the 'cases' below this entry. However, if
a
‘break’ statement is added, it will skip all the other statements
below.
..........................