Professional Documents
Culture Documents
Toaz - Info Arduino Course Final Exam PR
Toaz - Info Arduino Course Final Exam PR
Min
7. What command would you use to tell the Arduino that there is an output on port
9?
a. int sensorPin = 9;
b. int sensorValue = 9;
c. digitalWrite(9, HIGH);
d. pinMode(9, OUTPUT);
10. How do you read values from the Arduino on the computer screen?
a. the ‘View’ button
b. the ‘Serial Monitor’ button
c. the ‘Upload’ button
d. you cannot read values from the Arduino on the screen
11. What is the command for playing a musical note on the Arduino?
a. tone();
b. play();
c. note();
d. sound();
The questions in the next section are answered by referring to the following
program:
int sensorPin = A0;
int ledPin = 13;
int sensorValue = 0;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
sensorValue = analogRead(sensorPin);
digitalWrite(ledPin, HIGH);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
}
12. What is the purpose of line 4?
a. To begin the setup program structure
b. To begin the loop program structure
c. To set the input value of port 13 to ‘ON’
d. line 4 has no function in the program
1. #include <LiquidCrystal.h>
2. LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
3. int analogInput = 0;
4. float vout = 0.0;
5. float vin = 0.0;
6. float R1 = 100000.0; // resistance of R1 (100K)
7. float R2 = 10000.0; // resistance of R2 (10K)
8. int value = 0;
9. void setup(){
10. pinMode(analogInput, INPUT);
11. lcd.begin(16, 2);
12. lcd.print("DC VOLTMETER");
13. }
14. void loop(){
15. value = analogRead(analogInput);
16. vout = (value * 5.0) / 1024.0;
17. vin = vout / (R2/(R1+R2));
18. if (vin<0.09) {
19. vin=0.0}
20. lcd.setCursor(0, 1);
21. lcd.print("INPUT V= ");
22. lcd.print(vin);
23. delay(500);
24. }