Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • Robotics with the Board of Education Shield for Arduino

Robotics with the Board of Education Shield for Arduino

Modify the Sketch to Repeat

Microcontroller programs generally run in a loop, meaning that one or more statements are repeated over and over again.  Remember that the loop function automatically repeats any code in its block (the statements in between its curly braces).  Let’s try moving Serial.print(“Hello!”); to the loop function.  To slow down the rate at which the messages repeat, let’s also add a pause with the built-in delay(ms) function.

  • 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 below and verify that they are correct.
  • Upload the sketch to 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!"


Printer-friendly version
How the Hello Sketch Code Works
Prev
Hello Messages on New Lines
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress