Question
Write a top-level flowchart for the following code: #include LiquidCrystal lcd(13, 12, 11, 10, 8, 7); int degree; double realDegree; String lcdBuffer; int redled =
Write a top-level flowchart for the following code:
#include
LiquidCrystal lcd(13, 12, 11, 10, 8, 7); int degree; double realDegree; String lcdBuffer; int redled = 1; int greenled = 2; int buzzer = 4; int sensor = A3; int sensorThresh = 400;
void setup() { lcd.begin(16, 2); degree = 0; realDegree = 0; pinMode(redled, OUTPUT); pinMode(greenled,OUTPUT); pinMode(buzzer,OUTPUT); pinMode(sensor,INPUT); }
void loop(){{ lcd.print(" "); degree = analogRead(2); realDegree = (double)degree/1024; realDegree *= 5; realDegree -= 0.5; realDegree *= 100; lcd.setCursor(0,1); String output = String(realDegree) + String((char)178) + "C "; lcd.print(output); lcd.setCursor(0,0); lcd.print("Room Temp:"); }
int analogValue = analogRead(sensor); Serial.print(analogValue); if(analogValue>sensorThresh) { digitalWrite(redled,HIGH); digitalWrite(greenled,LOW); tone(buzzer,1000,10000); lcd.clear(); lcd.setCursor(0,1); lcd.print("ALERT"); delay(1000); lcd.clear(); lcd.setCursor(0,1); lcd.print("EVACUATE"); delay(1000); } else { digitalWrite(greenled,HIGH); digitalWrite(redled,LOW); noTone(buzzer); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started