Question

A program that averages two arrays of N elements where N is a whole number. A process of
temperature control has two temperature sensors A and B. From each sensor N samples are taken and
They store in a different arrangement. It is necessary to average the values ​​of the two sensors in another arrangement and
print it on the screen. The voltage range of the sensors ranges from 0 to 5 volts (0 0C to 100 0C)
Make with arduino program

Ejemplo: Para N 10 Arreglo muestras sensor A: Arreglo muestras sensor B: Arreglo promedio: 14 12 1.3 12 13 1.1 1.4 12 1.1 14

example
for N=10
arragment sample A
arragment sample B
arragment average

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#define sensorA A0
#define sensorB A1
#define N 10
float A[N];
float B[N];
float dataA = 0;
float dataB = 0;
float data[N];
void setup()
{
pinMode(sensorA, INPUT);
pinMode(sensorB, INPUT);
}

void loop()
{
for (int i = 0; i < N; i++)
{
A[i] = analogRead(sensorA) / 1023 * 5;
B[i] = analogRead(sensorB) / 1023 * 5;
data[i] = (A[i] + B[i]) / 2;
Serial.print(data[i]);
Serial.print('\t');
}
Serial.print('\n');
}

Add a comment
Know the answer?
Add Answer to:
A program that averages two arrays of N elements where N is a whole number. A...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT