Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Which of these can an Arduino NOT be used for? (2pts) controlling servos b. a

ID: 2265837 • Letter: 1

Question

1. Which of these can an Arduino NOT be used for? (2pts) controlling servos b. a. displaying analog inputs building robots d. c. an Arduino can be used to do all of these 2. What are the Arduino's two main program structures? (2pts) setup and loop b. a. main and setup loop and main c. d. int and setup 3. How many analog ports does an Arduino have? (2pts) a. five, and they are labeled Al-A5 vb. six, and they are labeled A0-AS c. six, and they are labeled Al-A6 d. five, and they are labeled A0-A4 4. Which of these is a digital input device? (2pts) a. pressure sensor b. servo c. button d. potentiometer 5. Which of these is an analog input device? (2pts) a. pressure sensor b. servo c. button d. LED 6. Which of these is an output device? (2pts) a. pressure sensor b. servo c. button d. potentiometer 7. What command would you use to tell the Arduino that port 9 is an output port? (2pts) a. int sensorPin = 9; b. int sensorvalue-9; c. digitalWrite(9, HIGH); d. pinMode(9, OUTPUT); 8. What command would you use to light up an LED on port 5? (2pts) a. int sensorPin = A0; b, int sensorValue = 0; c. digitalwrite(5, HIGH); d. pinMode(5, OUTPUT); 9. How would you pause a program for 2.5 seconds? (2pts) a. delay (2500) b. int sensorValue = 0; c. delay(2.5); d. pinMode(ledPin, OUTPUT);

Explanation / Answer

Solutions

1: Ans= (d)

a)The Arduino supports a servo library that enables control of small servo motors used in hobby projects.

b) Arduino can be easily used to read and display analog inputs through its analog input serial pins A0-A5.

c) Arduino can be used to build various kinds of robots such as line follower robot, gesture-controlled robot, robotic arm, etc.

d) Hence it can be used for all the above

2: Ans = (a)

Two special functions in Arduino programming are setup() and loop() and form the basic structure of the program. Both of them have a void return type.The setup() is run only once at the beginning and is used to declare and initialize the various pins, variables, etc. The loop() function is executed repeatedly and performs functions such as reading inputs and triggering outputs, etc.

3: Ans = (b)

Arduino has a total of 6 analog input pins. These pins are numbered from A0 to A5. In programming when using analog functions these pins are numbered as 0-5. But these same pins are numbered 14-19 when using with digital functions thus giving additional 6 digital pins.

4: Ans = (c)

a)The pressure sensor can be connected directly to the analog input of Arduino

b)Servo are output devices. They can turn to specified position

c)Button is a digital input device which can be used to send information related to its mode and state such as ON/OFF/HOLD/RELEASE. It can be used to carry out different operations.

d)A potentiometer is simply a variable resistance that can be fed to Arduino board as an analog value.

5: Ans =(a)

a)The pressure sensor is an analog input device. It can be connected directly to the analog input of Arduino.

b)Servo is an output device. It can turn to specified position

c)Button is a digital input device

d)LED can be used as a digital input device as a photodiode.

6: Ans = (b)

a)The pressure sensor is an analog input device.

b)Servos are output devices. They can turn to specified position

c)Button is a digital input device

d)A potentiometer is simply a variable resistance that can be fed to Arduino board as an analog input.

7: Ans = (d)

a) It sets the variable 'sensorPin' to 9

b) It sets the variable 'sensorValue' to 9

c) It sets HIGH value to digital pin 9

d) it configures the pin 9 to behave as OUTPUT

8: Ans = (c)

a) It sets the variable 'sensorPin' to A0

b) It sets the variable 'sensorValue' to 0

c) It sets HIGH value to digital pin '5' which turns on the LED

d) it configures the pin '9' to behave as OUTPUT

9: Ans = (a)

a)delay function pauses the program for specific amount of time in milliseconds. Hence 2500 milliseconds = 2.5 seconds

b) It sets the variable sensorValue to 0

c)it pauses the program for 2.5 milliseconds

d)it configures the pin value saved in the variable 'ledPin' to behave as OUTPUT