Question 2 is based on the following diagram and Arduino sketch. const int ledPin_red = 13;...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 2 is based on the following diagram and Arduino sketch. const int ledPin_red = 13; const int ledPin_yellow = 11; const int ledPin_green = 9; const int sensorPin = 0; void setup() { } O } pinMode(ledPin_green, OUTPUT); pinMode(ledPin_yellow, OUTPUT); pinMode(ledPin_red, OUTPUT); Serial.begin(9600); void loop() { float val analogRead (sensorPin); float map_val= map (val, 11, 816, 0, 90); detect (map_val); DIGITAL (PWM-) ∞ UNO ARDUINO POWER } RX+0 ANALOG IN 2222 void detect (float value) { if (value <= 30) { digitalWrite(ledPin_green, HIGH); digitalWrite(ledPin_yellow, HIGH); digitalWrite(ledPin_red, HIGH); Serial.println("Status: Gelap"); } if (value> 30 && value <= 85) { digitalWrite(ledPin_green, HIGH); digitalWrite(ledPin_yellow, HIGH); digitalWrite(ledPin_red, LOW); Serial.println("Status: Sedang"); } if (value> 85) { digitalWrite(ledPin_green, HIGH); digitalWrite(ledPin_yellow, LOW); digitalWrite(ledPin_red, LOW); Serial.println("Status: Terang"); a) [5] Draw the flowchart of this system! b) [3] If the minimum and maximum values read at A0 by analogRead (0) are 11 and 816, respectively, determine the minimum voltage received at A0 from the photoresistor! (Answer in voltage, 2 decimals) c) [3] If the minimum and maximum values read at A0 by analogRead(0) are 11 and 816, respectively, determine the maximum voltage received at A0 from the photoresistor! (Answer in voltage, 2 decimals) d) [5] If the photoresistor feeds in S volt at A0 pin, calculate and determine the value of map_val! (Answer in integer value, 1.00 V <S<3.50V) e) [4] If the photoresistor feeds in 3.98 V at A0 pin, determine the following outputs! ● Output Red LED Yellow LED ● Green LED Output Serial Value f) [20] Modify the above Arduino sketch to incorporate the push button that is connected to pin 4! The system behaves as follows. When the button is pressed, all the 3 LEDs must be active (ON). When the button is not pressed, the system behaves as in the original sketch of problem 2. Value (Text) Question 2 is based on the following diagram and Arduino sketch. const int ledPin_red = 13; const int ledPin_yellow = 11; const int ledPin_green = 9; const int sensorPin = 0; void setup() { } O } pinMode(ledPin_green, OUTPUT); pinMode(ledPin_yellow, OUTPUT); pinMode(ledPin_red, OUTPUT); Serial.begin(9600); void loop() { float val analogRead (sensorPin); float map_val= map (val, 11, 816, 0, 90); detect (map_val); DIGITAL (PWM-) ∞ UNO ARDUINO POWER } RX+0 ANALOG IN 2222 void detect (float value) { if (value <= 30) { digitalWrite(ledPin_green, HIGH); digitalWrite(ledPin_yellow, HIGH); digitalWrite(ledPin_red, HIGH); Serial.println("Status: Gelap"); } if (value> 30 && value <= 85) { digitalWrite(ledPin_green, HIGH); digitalWrite(ledPin_yellow, HIGH); digitalWrite(ledPin_red, LOW); Serial.println("Status: Sedang"); } if (value> 85) { digitalWrite(ledPin_green, HIGH); digitalWrite(ledPin_yellow, LOW); digitalWrite(ledPin_red, LOW); Serial.println("Status: Terang"); a) [5] Draw the flowchart of this system! b) [3] If the minimum and maximum values read at A0 by analogRead (0) are 11 and 816, respectively, determine the minimum voltage received at A0 from the photoresistor! (Answer in voltage, 2 decimals) c) [3] If the minimum and maximum values read at A0 by analogRead(0) are 11 and 816, respectively, determine the maximum voltage received at A0 from the photoresistor! (Answer in voltage, 2 decimals) d) [5] If the photoresistor feeds in S volt at A0 pin, calculate and determine the value of map_val! (Answer in integer value, 1.00 V <S<3.50V) e) [4] If the photoresistor feeds in 3.98 V at A0 pin, determine the following outputs! ● Output Red LED Yellow LED ● Green LED Output Serial Value f) [20] Modify the above Arduino sketch to incorporate the push button that is connected to pin 4! The system behaves as follows. When the button is pressed, all the 3 LEDs must be active (ON). When the button is not pressed, the system behaves as in the original sketch of problem 2. Value (Text)
Expert Answer:
Answer rating: 100% (QA)
a Flowchart of the system Start Set ledPinred 13 Set ledPinyellow 11 Set ledPingreen 9 Set sensorPin ... View the full answer
Related Book For
Posted Date:
Students also viewed these electrical engineering questions
-
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...
-
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...
-
Question a) to g) are based on the following Arduino Uno figure. B E A D4 F 9000 9A5 DIGITAL (PWM-) E O UNO ARDUINO NOVES HERMAN POWER O www.ARDUINO.CC MADE IN ITALY JK L ON 8 G ANALOG ICSP H Input...
-
For what number does the principal square root exceed eight times the number by the largest amount?
-
Faculty members at a leading business school receive a budget to cover research expenditures, soft-ware and hardware purchases, travel expenses, photocopying for classroom use, and so forth. The...
-
Softball Magazine Company received advance payments of $5,000 from customers during 2009. At December 31, 2009, $1,200 of the advance payments still had not been earned. Required: After the...
-
Explain the acronyms AIM, SETS, MTF and HFT.
-
Marshall Tool and Die Company have been experiencing significant foreign competition and a declining market. Annual net losses from operations have averaged $250,000 over the last three years. The...
-
What ethical standards regarding worker safety and working conditions should socially responsible companies hold foreign factories to: those prevailing in the host country or those prevailing at...
-
Kepler's second law states that as a planet moves around in its orbit, it sweeps out equal areas in equal times. Examine the following figure, which shows a planet (blue dot, labeled "E"), orbiting...
-
How we can be knowledgeable, or how our ideas can be helpful or offensive to others at times?
-
Share whether you think an individual has to be a strong leader in order to be an effective manager. Explain why or why not, with reference to the articles above to support your position. Further...
-
You are a Singapore-based foreign exchange trader, and you observe a put option for (Australian dollars) A$125,000 with an exercise price of (Singapore dollars) S$0.57 and a premium of S$0.02. The...
-
(This exercise is slightly modified from D. E. Simon, "An Embedded Software Primer," Addison-Wesley Professional, 1999.) Where in the following code do you need to disable and re-enable interrupts to...
-
Truck Co . purchased a new car on March 1 , 2 0 1 9 for $ 9 0 , 0 0 0 . The estimated useful life of the car was 4 0 0 , 0 0 0 kms . After reaching 4 0 0 , 0 0 0 kms , the car will still function,...
-
Explain the seasonality demand of Etihad Airways? (For example, climate and political)
-
198.150.11.15 198.150.11.16 198.150.11.17 198.150.11.18 198.150.11.19 Address 198.150.11.255 198.150.11.1 E0 Internet Address 198.150.12.255 198.150.12.1 E1 198.150.12.12 198.150.12.13 198.150.12.14...
-
From the choice of simple moving average, exponential smoothing, and linear regression analysis, which forecasting technique would you consider the most accurate? Why? please write it in word...
-
Using the financial statements provided below and any other information you find relevant, answer the following questions: a. What was the book value of Avons shareholders equity from 2001 to 2003?...
-
Dome Appliance, Inc., a private firm that manufactures home appliances, has hired you to estimate the companys beta. You have obtained the following equity betas for publicly traded firms that also...
-
Pro forma financial statements, by definition, are predictions of a companys financial statements at a future point in time. So why is it important to analyze the historical performance of the...
-
Which of the following represents the correct sequence of the flow of costs in a typical manufactur- ing company? The solution is on a. Direct materials, cost of goods sold, work-in-process...
-
Shea Company reported raw material purchases of \($1,400,\) paid \($1,200\) in factory labor, and incurred and applied \($900\) in factory overhead for March. The March 1 inventory balances were...
-
Assume you own a manufacturing company that budgets an estimated \($250,000\) in overhead for the coming year and 10,000 direct labor hours. Also assume your manufacturing overhead application base...
Study smarter with the SolutionInn App