Arduino Programming Worksheet
1. What is an Arduino? What are programs called in the Arduino programming environment? What is the
extension for an Arduino program?
2. What is the difference between “Digital” and “Analog” pins. What purpose do they fulfill on an
Arduino.
3. Why are you required to import libraries in Arduino IDE?
4. What is the purpose of the red push button on the Arduino Uno board?
5. What are comments, and why are they necessary?
6. Give two examples of datatypes that can be used in Arduino programming.
7. What is the difference between a local variable and a global variable?
8. Answer the following the questions based on the code snippet below:
void loop() {
// Set motor A speed and direction
analogWrite (enA, 110); //Speed control (0-255)
digitalWrite (in1, HIGH);
digitalWrite (in2, LOW);
//Set motor B speed and direction
analogWrite (enB, 110); //Speed control (0-255)
digitalWrite (in3, HIGH);
digitalWrite (in4, LOW);
}
a) Create a variable called motorSpeed to store the speed of the DC motors. Rewrite the code above
so that the variable is substituted for the value 110, and the motors spin in opposite directions.
b) Create a second variable, motorSpeed2. Using motorSpeed and motorSpeed2, modify the code so
that motor B spins twice the speed of motor A in the same direction.