Chapter 1 Challenges


  1. What device will be the brain of your BOE Shield-Bot?
  2. When the Arduino sends a character to your PC/laptop, what type of numbers are used to send the message through the programming cable?
  3. What is the difference between the setup and loop functions?
  4. What’s the difference between a variable name and a variable type?
  5. What’s the difference between global and local variables?
  6. What are the arithmetic operators?  What does each one do?
  7. What variable type will the Arduino editor apply to 21.5 if it appears in your code?  Why?
  8. What three elements are included between parentheses in a for loop?
  9. What’s the difference between a block comment and a line comment?


  1. Write a piece of code that displays “the value of i = ” followed by the value of stored in the variable i in the Serial Monitor.  Both should display on the same line, and then move the cursor to the beginning of the next line for displaying more messages.
  2. Declare a long variable named bigVal, and initialize it to 80 million.
  3. Write an if…else statement that takes the modulus of a variable divided by 2 and compares it to zero.  If the result is zero, display “The variable is even.”  If not, display “The variable is odd.”
  4. Write a for loop that starts counting at 21 and stops at 39, and counts in steps of 3.
  5. Write a piece of code that displays the character a variable stores along with its ASCII value.
  6. Write a for loop, but instead of counting from one value to another, make it count from 'A' to 'Z' and display the letters in the alphabet.


  1. Write a sketch to display the printable ASCII characters.  The first printable character is the space character, which is one press/release of your keyboard’s space bar between apostrophes, like this: ‘ ’.  The last printable character is the tilde character ‘~’.  Alternately, you could use 32 for the loop’s start value and 126 for the end value.
  2. Write a sketch that tells you if a variable is odd or even.  Hint: when a number is even, the remainder of the number divided by 2 is 0.  Hint: variable % 2 == 0.