Inspect circuit and code.   boolean light_on; volatile int counter; volatile boolean updateFlag; void setup() { Serial.begin(9600); attachInterrupt(0, interruptServiceRoutine, FALLING); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); pinMode(2, INPUT); counter = 0; updateFlag = false; } void loop() { if (updateFlag) { updateFlag = false; Serial.print("Current Count "); Serial.print(counter); Serial.println(";"); } digitalWrite(10, bitRead(counter, 3)); digitalWrite(11, bitRead(counter, 2)); digitalWrite(12, bitRead(counter, 1)); digitalWrite(13, bitRead(counter, 0)); // least significant bit delay(200); } void interruptServiceRoutine() { counter = (counter + 1) % 16; updateFlag = true; } You can assume that void setup() takes 0.1s to execute. You can neglect the time it takes to execute statements other than 'delay(200);' in the function 'void loop()'. Select all correct choices (0 or more). 多项选择题

题目图片
A

'pinMode(13, OUTPUT);' configures digital pin 13 to act as an output, meaning it can sense HIGH (5V) or LOW (0V) signals.

B

'digitalWrite(10, HIGH);' writes a HIGH value to digital pin 10.

C

'delay(200);' causes a delay of 200 microseconds.

D

Pressing the button 20 times in 0.2s intervals will result in a final counter value of 2, assuming the first button press occurs just as the loop starts.

E

Pressing the button 20 times in 0.02s intervals will result in a final counter value of 2, assuming the first button press occurs just as the loop starts.

F

The right LED will be on if counter = 7.

G

Pressing the button 20 times in 0.2s intervals will result in a final counter value of 20, assuming the first button press occurs just as the loop starts.

登录即可查看完整答案

我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。

类似问题

Inspect circuit and code.   boolean light_on; volatile int counter; volatile boolean updateFlag; void setup() { Serial.begin(9600); attachInterrupt(0, interruptServiceRoutine, FALLING); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); pinMode(2, INPUT); counter = 0; updateFlag = false; } void loop() { if (updateFlag) { updateFlag = false; Serial.print("Current Count "); Serial.print(counter); Serial.println(";"); } digitalWrite(10, bitRead(counter, 3)); digitalWrite(11, bitRead(counter, 2)); digitalWrite(12, bitRead(counter, 1)); digitalWrite(13, bitRead(counter, 0)); // least significant bit delay(200); } void interruptServiceRoutine() { counter = (counter + 1) % 16; updateFlag = true; } You can assume that void setup() takes 0.1s to execute. You can neglect the time it takes to execute statements other than 'delay(200);' in the function 'void loop()'. Select all correct choices (0 or more). 

ID:q4vC. Study the following diagram and code:   boolean light_on = false; boolean interruptFired = false; int counter = 0; void setup() { Serial.begin(9600); attachInterrupt(0, interruptServiceRoutine, FALLING); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); pinMode(2, INPUT); } void loop() { delay(1000); if (interruptFired) { interruptFired = false; counter = counter + 1;       Serial.print("Current Count "); Serial.print(counter); Serial.println(";"); } digitalWrite(10, bitRead(counter, 0)); digitalWrite(11, bitRead(counter, 1)); digitalWrite(12, bitRead(counter, 2)); digitalWrite(13, bitRead(counter, 3)); } void interruptServiceRoutine() { interruptFired = true; } This circuit is intended to count each button press, displaying the current count on the terminal and in unsigned binary on the LEDs. Suppose the button is pressed 7 times, with each button press occurring at regular 200ms intervals. The first button press occurs 5 ms after the loop function starts executing for the first time (5 ms into the delay(1000) line). You can neglect the time it takes to execute statements other than 'delay()' in the function 'void loop()'. What is the final value of the variable counter? Write your answer in decimal. Note that the code and question are different from your tutorial activities.

ID:q4vC. Study the following diagram and code:   boolean light_on = false; boolean interruptFired = false; int counter = 0; void setup() { Serial.begin(9600); attachInterrupt(0, interruptServiceRoutine, FALLING); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); pinMode(2, INPUT); } void loop() { delay(1000); if (interruptFired) { interruptFired = false; counter = counter + 1;       Serial.print("Current Count "); Serial.print(counter); Serial.println(";"); } digitalWrite(10, bitRead(counter, 0)); digitalWrite(11, bitRead(counter, 1)); digitalWrite(12, bitRead(counter, 2)); digitalWrite(13, bitRead(counter, 3)); } void interruptServiceRoutine() { interruptFired = true; } This circuit is intended to count each button press, displaying the current count on the terminal and in unsigned binary on the LEDs. Suppose the button is pressed 5 times, with each button press occurring at regular 500ms intervals. The first button press occurs 5 ms after the loop function starts executing for the first time (5 ms into the delay(1000) line). You can neglect the time it takes to execute statements other than 'delay()' in the function 'void loop()'. What is the final value of the variable counter? Write your answer in decimal. Note that the code and question are different from your tutorial activities.

Name the Supreme Court decision that removed financial constraints on PACs.

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!