Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Basic Programming Worksheet Write an Arduino program that maintains room tempera

ID: 3877526 • Letter: B

Question

Basic Programming Worksheet Write an Arduino program that maintains room temperature by taking temperature readings from 15 thermocouples (temperature sensors) and operating 3 fans and 2 heaters. The program below reads information from 15 thermocouples and computes the average temperature. Fill in the blanks. a. conat int int avgtemp, tempSum-0 int i-0 / Called a counter, variable to keep count of tor loop iterations e to a pin nunber moving sequentially tt // Note: Explicitly writing A in front of the pin nunber is not ne for i “ 0; void loop ) i torti- 0 Read ( // Add up all the temperatures

Explanation / Answer

1. Simple Answer just read values from pin and store in array then find the average . The tempPin array store the values of all pins digital output;

const int tempPin[15];

int avgTemp, tempSum=0;

int i =0;

void loop(){

for(i=0;i<15;i++){

tempPin[i]=digitalRead(i)

pinMode(i, OUTPUT);

}

}

void loop(){

avgTemp=0;

for(i=0;i<15;i++){

tempSum+=tempPin(i)

}

}

avgTemp = tempSum/15;

SAMPLE OUTPUT =1 , if all pins have values 1