Please answer the questions based on the figure below! a. Which pin number is assigned to the
Fantastic news! We've Found the answer you've been seeking!
Question:
Please answer the questions based on the figure below!
a. Which pin number is assigned to the input of the system?
b. Explain the function of the code on line 9! digitalWrite(inPin, HIGH);
c. What is the voltage value at pin no. 2 if the button is pressed? Explain!
Transcribed Image Text:
Sketch 1 2 3 4 5 6 7 8 pinMode(inPin, INPUT); 9 digitalWrite(inPin, HIGH); pinMode(ledPin, OUTPUT); 10 11 Serial.begin(9600); 12 13 14 15 16 17 const int ledPin = 13; const int inPin = 2; const int debounceTime = 20; int count = 0; 2222 void setup() { CIRCUIT } void loop() { int duration = switchTime(); 18 19 20 { if (duration > debounceTime) {count = count + 1; digitalWrite(ledPin, HIGH);} else 21 if( count = 0) digitalWrite(ledPin, LOW); 23 else 24 { ∞ UNO digitalWrite(ledPin, HIGH); 25 26 count == 0; 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 } } Serial.println(count); delay(100); } long switchTime() { static unsigned long startTime = 0; static boolean state; if(digitalRead(inPin) != state) { state = state; startTime = millis(); } if( state == LOW) return millis() else return 0; } startTime; Sketch 1 2 3 4 5 6 7 8 pinMode(inPin, INPUT); 9 digitalWrite(inPin, HIGH); pinMode(ledPin, OUTPUT); 10 11 Serial.begin(9600); 12 13 14 15 16 17 const int ledPin = 13; const int inPin = 2; const int debounceTime = 20; int count = 0; 2222 void setup() { CIRCUIT } void loop() { int duration = switchTime(); 18 19 20 { if (duration > debounceTime) {count = count + 1; digitalWrite(ledPin, HIGH);} else 21 if( count = 0) digitalWrite(ledPin, LOW); 23 else 24 { ∞ UNO digitalWrite(ledPin, HIGH); 25 26 count == 0; 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 } } Serial.println(count); delay(100); } long switchTime() { static unsigned long startTime = 0; static boolean state; if(digitalRead(inPin) != state) { state = state; startTime = millis(); } if( state == LOW) return millis() else return 0; } startTime;
Expert Answer:
Posted Date:
Students also viewed these electrical engineering questions
-
The basic monthly salary of Freddy is R10 000. She is entitled to an annual bonus of R9 000. Her employer contributes R9 000 per annum to her pension fund. She works for 9 hours per day from Monday...
-
Answer the questions based on these two annual reports. (Auckland Airport )https://corporate.aucklandairport.co.nz/investors/results-and-reports(2018 Financial Statements) (Air New Zealand)...
-
Answer the questions based on concept and your understanding of how the budget numbers are interrelated. Assume each of the following questions is an independent situation. A. what would be the...
-
Problem 8-46 (LO. 2, 4, 9) Dennis Harding is considering acquiring a new automobile that he will use 100% for business in the subsequent year. The purchase price of the automobile would be $54,500....
-
Try to think of additional examples of brands that adopted either a back-to-basics or reinvention revitalization strategy. How well did they work?
-
When are prior period adjustments used?
-
You are in an elevator moving between two floors of a building at constant speed. Compare the work done on you by the elevator when you are moving upward to a higher floor to the work done when you...
-
Henderson Office Supply is considering a more liberal credit policy to increase sales, but expects that 9 percent of the new accounts will be uncollectible. Collection costs are 6 percent of new...
-
1. Hydrogenation of the above compound in the presence of poisoned palladium catalyst gives Me Me Me H H (a) An optically active compound (c) A racemic mixture (b) An optically inactive compound (d)...
-
On February 1, 2014, Punto Company purchased 95% of the outstanding common stock of Sara Company and 85% of the outstanding common stock of Rob Company. Immediately before the two acquisitions,...
-
3) One long solenoid is placed inside another solenoid. Both solenoids have the same length and the same number of turns of wire, but the outer solenoid has twice the diameter of the inner solenoid....
-
Show that if a liquid is in equilibrium with its own vapour and an inert gas in a closed vessel, then \[\frac{\mathrm{d} p_{v}}{\mathrm{~d} p}=\frac{ho_{v}}{ho_{l}}\] where \(p_{v}\) is the partial...
-
A steam turbine operates on a Carnot cycle, with a maximum pressure of 20 bar and a condenser pressure of 0.5 bar. Calculate the salient points of the cycle, the energy addition and work output per...
-
Recalculate P3.1 assuming that the pump efficiency, \(\eta_{\mathrm{P}}=0.8\), and the turbine efficiency, \(\eta_{\mathrm{T}}=\) 0.9. Comment on the effect on the thermal efficiency of the plant,...
-
Show, for a gas obeying the state equation \[p v=(1+\alpha) \Re T\] where \(\alpha\) is a function of temperature alone, that the specific heat at constant pressure is given by \[c_{p}=-\Re T...
-
A cycle is proposed as a development of the Lenoir cycle, in which the working fluid is expanded isentropically from its peak pressure down to a point where its temperature is equal to \(T_{1}\), the...
-
Opportunity costs exist because: the decision to engage in one activity means forgoing some other activity. wants are scarce relative to resources. households and businesses make rational decisions....
-
1. What is the semi-annually compounded interest rate if $200 accumulates to $318.77 in eight years? Answer in percentage with two decimal places. 2. What is the quarterly compounded interest rate if...
-
In a recent study of how mice negotiate turns, the mice ran around a circular 90 turn on a track with a radius of 0.15 m. The maximum speed measured for a mouse (mass = 18.5 g) running around this...
-
It is well known that runners run more slowly around a curved track than a straight one. One hypothesis to explain this is that the total force from the track on a runners feet the magnitude of the...
-
Biologists have studied the running ability of the northern quoll, a marsupial indigenous to Australia. In one set of experiments, they studied the maximum speed that quolls could run around a curved...
Study smarter with the SolutionInn App