Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part II: Modify the code to display the temperature in both Celsius and Fahrenheit scales. Attach screenshot of the code. modify this code: const int

Part II: Modify the code to display the temperature in both Celsius and Fahrenheit scales. Attach screenshot of the code.

modify this code:

const int sensorPin = A0; const float baselineTemp = 24.0; slightly change it to see effects void setup() { Serial.begin(9600); Digital Communication baud rare for (int pinNumber = 2; pinNumber < 5; pinNumber++) { pinMode(pinNumber,OUTPUT); digitalWrite(pinNumber,LOW); } } void loop(){ int sensorVal=analogRead(sensorPin); Serial.print("Sensor Value: "); 9 Serial.print(sensorVal); float voltage = (sensorVal/1024.0)*5.0; for 10-bit ADC, 210=1024 Serial.print(",Volts: "); Serial.print(voltage); Serial.print(", degrees C: "); float temperature = (voltage)*100; Serial.println(temperature); if (temperature < baselineTemp){ digitalWrite(2,LOW); digitalWrite(3,LOW); digitalWrite(4,LOW); } else if (temperature >= baselineTemp && temperature < baselineTemp+2) { digitalWrite(2,HIGH); digitalWrite(3,LOW); digitalWrite(4,LOW); } else if (temperature >= baselineTemp+2 && temperature < baselineTemp+4) { digitalWrite(2,HIGH); digitalWrite(3,HIGH); digitalWrite(4,LOW); } else if (temperature >= baselineTemp+4) { digitalWrite(2,HIGH); digitalWrite(3,HIGH); digitalWrite(4,HIGH); } delay(100); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago

Question

What magazine and ads did you choose to examine?

Answered: 1 week ago