0% found this document useful (0 votes)
3 views2 pages

Arduino Programming Basics Worksheet

The document is a worksheet focused on Arduino programming, covering fundamental concepts such as the definition of Arduino, the purpose of digital and analog pins, and the necessity of importing libraries. It also addresses the function of components like the red push button on the Arduino Uno, the importance of comments in code, and the distinction between local and global variables. Additionally, it includes practical coding exercises involving the manipulation of motor speeds using variables in a code snippet.

Uploaded by

vanhoang0713
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Arduino Programming Basics Worksheet

The document is a worksheet focused on Arduino programming, covering fundamental concepts such as the definition of Arduino, the purpose of digital and analog pins, and the necessity of importing libraries. It also addresses the function of components like the red push button on the Arduino Uno, the importance of comments in code, and the distinction between local and global variables. Additionally, it includes practical coding exercises involving the manipulation of motor speeds using variables in a code snippet.

Uploaded by

vanhoang0713
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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.

You might also like