Hardware Reference
In-Depth Information
3.3 Serial Communication
We can access Serial Port (UART) from Arduino Sketch using Serial object,
ht-
Open software Arduino Sketch and write this code.
unsignedlong
counter;
int
led =
13
;
void
setup
()
{
counter =
0
;
Serial.begin(
9600
);
}
void
loop
()
{
Serial.println(counter);
delay(
1000
);
counter++;
if
(counter>=
100
)
counter =
0
;
}
Save this code with name
SerialDemo
. Now you can compile and deploy this program to
board.
To verify this program, you can use Serial Monitor. It can be called by clicking menu Tools
-> Serial Monitor.
If success, you get a dialog. It shows message from Arduino UART.
