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)
e The reference voltage for the Arduino ADC is 5 V and its a 10 bit ADC Hence the max value in Ardui... 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?
-
Assume the time required to pass through security at a particular airport follows the continuous uniform distribution with a minimum time of 5 minutes and maximum time of 30 minutes. a. Calculate the...
-
In a study of 413 nonprofits nationwide, 83 indicated that turnover has been the biggest employment challenge at their organization. (Source: Nonprofit HR, 2014 Nonprofit Employment Practices Survey,...
-
A heat pipe is an evaporator-condenser system in which the liquid is returned to the evaporator by capillary action. In the simplest form it consists of a wire-mesh region that serves to act as a...
-
The Hamilton Company balance sheet on January 1, 2007 was as follows: The Korbel Company is considering purchasing the Hamilton Company (a privately held company) and discovers the following about...
-
ces On January 1, 2024, the Mason Manufacturing Company began construction of a building to be used as its office headquarters. The building was completed on September 30, 2025. Expenditures on the...
-
In Part III (Appendix 11B) of the audit case, the audit staff of Adams, Barnes & Co. identified specific revenue risks on working paper RA-12 (page 494). However, the Summary of Audit Approach...
-
Changes in stockholders' equity Listed are the equity sections of balance sheets for years 2014 and 2015 as reported by Mountain Air Ski Resorts, Inc. The overall value of stockholders equity has...
-
What are the requirements for establishing that the tort of unlawful interference with economic interests has been committed?
-
What makes a constitutional defeat before the courts so serious for a legislature?
-
Give examples of the principal types of abuse of dominant position.
-
What is a conspiracy? How does the Competition Act categorize conspiracies?
-
What are the advantages of a settlement over a court trial?
-
Kennedy Company reported the following amounts for the year 2020. Required: Prepare the Cost of Goods Manufactured Schedule for Kennedy Company. Direct materials used $30,000 Finished goods...
-
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...
-
According to the ACFE 2016 Report to the Nations, which of the following is the most frequent source of initial fraud detection? 1. A call to the police 2. Tips 3. Accidental discovery 4. The...
-
Select the statement that is most accurate with regard to materiality. 1. Materiality does not create discretionary choices for managers, executives, and auditors. 2. Earnings management is not...
-
Which of the following is not a step in the targeted fraud risk assessment process? 1. Identify the parties who have the ability to commit the potential fraud. 2. Place the parties who most likely...
Study smarter with the SolutionInn App