Datasheet
Your Shield-Bot’s Brain • Chapter 1
Robotics with the BOE Shield-Bot • 23
Save HelloMessage as HelloRepeated.
Move
Serial.print("Hello!"); from setup to the loop function.
Add
delay(1000); on the next line.
Compare your changes to the figure and verify that they are correct.
Run the sketch on the Arduino and then open the Serial Monitor again.
The added line
delay(1000) passes the value 1000 to the delay function’s ms parameter.
It’s requesting a delay of 1000 milliseconds. 1 ms is 1/1000 of a second. So,
delay(1000)
makes the sketch wait for 1000/1000 = 1 second before letting it move on to the next line of
code.
Hello Messages on New Lines
How about having each "Hello!" message on a new line? That would make the messages
scroll down the Serial Monitor, instead of across it. All you have to do is change
print
to
println, which is short for ‘print line.’
Change
Serial.print("Hello!") to Serial.println("Hello!").
Run the modified sketch and watch it print each "Hello!" message on a new line.