Question

In: Electrical Engineering

Based on the hardware you designed, write a code that takes temperature measurement every 5 seconds...

Based on the hardware you designed, write a code that takes temperature measurement every 5 seconds and display the temperature in Fahrenheit degrees in the format of xxx.x (for example: 098.6 or 104.8) on the 4-bank seven-segment LED display.

Solutions

Expert Solution

nt temp;
int tempPin = A2;
int x,y;
int bcd_array[10][7] = { { 0,0,0,0,0,0,1 }, // 0
{ 1,0,0,1,1,1,1 }, // 1
{ 0,0,1,0,0,1,0 }, // 2
{ 0,0,0,0,1,1,0 }, // 3
{ 1,0,0,1,1,0,0 }, // 4
{ 0,1,0,0,1,0,0 }, // 5
{ 0,1,0,0,0,0,0 }, // 6
{ 0,0,0,1,1,1,1 }, // 7
{ 0,0,0,0,0,0,0 }, // 8
{ 0,0,0,1,1,0,0 }}; // 9

void BCD0(int);
void BCD1(int);

void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(A2, INPUT);  
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
}


void loop()
{
temp = analogRead(tempPin);
temp = temp * 0.48828125;
x = (temp/10);
y = (temp -((temp / 10) * 10));
delay(1000)
BCD0(x);
BCD1(y);
}

void BCD0(int number)
{
int pin= 2;
for (int j=0; j < 7; j++) {
digitalWrite(pin, bcd_array[number][j]);
pin++;
}
}


void BCD1(int number)
{
int pin= 9;
for (int j=0; j < 7; j++) {
digitalWrite(pin, bcd_array[number][j]);
pin++;
}
}


Related Solutions

Based on the hardware you designed, write a code that takes temperature measurement every 5 seconds...
Based on the hardware you designed, write a code that takes temperature measurement every 5 seconds and display the temperature in Fahrenheit degrees in the format of xxx.x (for example: 098.6 or 104.8) on the 4-bank seven-segment LED display.
, Recording the time it takes (in seconds) for the temperature to drop in increments of...
, Recording the time it takes (in seconds) for the temperature to drop in increments of 2ºC:                               Temperature(°C)                  Time(in second)                          2ºC                  00:52.82                          2ºC                  00:53.94                          2ºC:                  00:64.48                        2ºC:                   00:67.44                          2ºC:                  00:68.34                        2ºC                  00:79.83 1, You will treat temperature as if it were a concentration (of heat). In order to analyze the data, you will need to know the difference between each temperature value recorded and the original...
Write a C++ code that can convert time into hours, minutes, seconds. It can accept (seconds),...
Write a C++ code that can convert time into hours, minutes, seconds. It can accept (seconds), (minutes, seconds), (hours, minutes, seconds) The input can be written in main It should produce the following output: (67.4, 14, 5) is 67 Hours, 38 Minutes, 5 Seconds (127.86) is 0 Hours, 2 Minutes, 8 Seconds (-3, 73, 2) is -1 Hours, -46 Minutes, -58 Seconds
Time String to Seconds Write a method that takes a string representation of time in hours:minutes:seconds...
Time String to Seconds Write a method that takes a string representation of time in hours:minutes:seconds and returns the total number of seconds For example, if the input is “0:02:20” it would return 140 If the input string is missing the hours component it should still work For example, input of “10:45” would return 645 Write an overloaded form of the method that takes in only hours and minutes and returns the total number of seconds It should leverage the...
CODE IN C++ PLEASE Write a program to implement the algorithm that you designed in Exercise...
CODE IN C++ PLEASE Write a program to implement the algorithm that you designed in Exercise 19 of Chapter 1. Your program should allow the user to buy as many items as the user desires. Instructions for Exercise 19 of Chapter 1 have been posted below for your convenience. Exercise 19 Jason typically uses the Internet to buy various items. If the total cost of the items ordered, at one time, is $200 or more, then the shipping and handling...
MATLAB CODE Let’s say you need to write a small script that takes in the total...
MATLAB CODE Let’s say you need to write a small script that takes in the total amount of money entered, and a cost, and returns the correct change in quarters/dimes/nickels/pennies. Initialize counter variables for quarters, dimes, nickels and pennies to 0. Counter variables are used to keep track of how many of each coin are to be returned. Calculate the amount of change to be given using the ‘total’ and ‘cost’ variables. While there is still change to be given,...
MATLAB CODE Let’s say you need to write a small script that takes in the total...
MATLAB CODE Let’s say you need to write a small script that takes in the total amount of money entered, and a cost, and returns the correct change in quarters/dimes/nickels/pennies. Initialize counter variables for quarters, dimes, nickels and pennies to 0. Counter variables are used to keep track of how many of each coin are to be returned. Calculate the amount of change to be given using the ‘total’ and ‘cost’ variables. While there is still change to be given,...
Using the code below from “LStack.h” file, write the code for a main program that takes...
Using the code below from “LStack.h” file, write the code for a main program that takes as input an arithmetic expression. The program outputs whether the expression contains matching grouping symbols. For example, the arithmetic expressions { 25 + ( 3 – 6 ) * 8 } and 7 + 8 * 2 contains matching grouping symbols. However, the expression 5 + { ( 13 + 7 ) / 8 - 2 * 9 does not contain matching grouping symbols....
Write an essay on different temperature measurement devices. Explain the operational principle of each device
Write an essay on different temperature measurement devices. Explain the operational principle of each device, its advantages and disadvantages, its cost, and its range of applicability. Which device would you recommend for use in the following cases: taking the temperatures of patients in a doctor’s office, monitoring the variations of temperature of a car engine block at several locations, and monitoring the temperatures in the furnace of a power plant?    
Python Practice Sample:   Write code to replace every occurrence of THE or the with ### and...
Python Practice Sample:   Write code to replace every occurrence of THE or the with ### and every word ending with the letter s to end with a $. Print the resulting text four words per line (and any remaining words from each paragraph on the last one of each paragraph) "The modern business world goes way beyond the balance sheet. Whether your passion is finance or fashion, economics or the environment, you need an education built for business. At Bentley,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT