Question
Write a program for the mbed that will periodically read and display the temperatures from the LM35 and the LMT87. Your program should use the
Write a program for the mbed that will periodically read and display the temperatures from the LM35 and the LMT87. Your program should use the mean average voltage from the temperature sensor (computed over at least 1000 samples) so that the displayed value does not fluctuate due to noise when the temperature is stable. The temperatures should be displayed as the nearest integer on the 7-segment display in Celcius or Fahrenheit, depending on the current mode. Since the display can only display one digit, you must display the temperature one digit at a time. Display each digit for 0.5 1 seconds, then blank the display for 0.1 seconds (this way the user can distinguish a digit shown once from two digits with the same value shown consecutively). After showing the temperature, the display should show "C" for Celcius or "F" for Fahrenheit for 0.5 1 seconds and then blank the display for 0.1 seconds. Then the display should show "i" for indoor or "o" for outdoor for 0.5 1 seconds and then blank the display for 0.1 seconds. Use lowercase "i" and "o" so that they are distinguishable from "1" and "0" on the display. Note that the outdoor temperature might be less +VS VOUT GND LM3 5 than 0, in which case you will need to display the leading negative sign (if you want to test this without a freezer, disconnect p20 from the LMT87 and connect it instead to the mbed's VOUT; this corresponds to a temperature of around -50 C or -58 F). Pressing the switch connected to p21 selects the Celcius mode. Pressing the switch connected to p22 selects displaying the Fahrenheit mode. If neither switch is pressed, the temperature is unchanged. When your program starts, it may default to whichever mode you prefer. Your program should check the state of the switches at least once per set of indoor/outdoor temperatures displayed (so the user might have to hold down the switch for an entire display cycle to switch modes). If you want to, you can detect mode changes more often, but you should completely display the temperature in one mode or the other (for example, don't display the first digit from the indoor temperature and the second digit from the outdoor temperature). Note that your program should display temperatures even if the switches have never been pressed.
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