0
0
Arduinoprogramming~10 mins

Multiple sensor fusion in Arduino - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to read the temperature sensor value.

Arduino
int tempValue = analogRead([1]);
Drag options to blanks, or click blank then click option'
AA0
BD2
C13
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using a digital pin number instead of an analog pin.
Confusing pin numbers with port names.
2fill in blank
medium

Complete the code to calculate the average of two sensor readings.

Arduino
int average = (sensor1 + [1]) / 2;
Drag options to blanks, or click blank then click option'
Asensor3
Bsensor2
Csensor4
Dsensor5
Attempts:
3 left
💡 Hint
Common Mistakes
Adding the wrong sensor variable.
Forgetting to divide by 2 after adding.
3fill in blank
hard

Fix the error in the code to combine sensor values correctly.

Arduino
float combined = (sensor1 [1] sensor2) / 2.0;
Drag options to blanks, or click blank then click option'
A+
B*
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication instead of addition.
Dividing one sensor by 2 before adding.
4fill in blank
hard

Fill both blanks to create a dictionary of sensor names and their readings, filtering only sensors with values above 500.

Arduino
std::map<String, int> sensorData = [1];
for (auto const& sensor : sensors) {
  if (sensor.second [2] 500) {
    sensorData[sensor.first] = sensor.second;
  }
}
Drag options to blanks, or click blank then click option'
A{}
B==
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using equality or less than instead of greater than.
Not initializing the map properly.
5fill in blank
hard

Fill all three blanks to create a fused sensor value by weighting three sensors differently.

Arduino
float fusedValue = ([1] * 0.5) + ([2] * 0.3) + ([3] * 0.2);
Drag options to blanks, or click blank then click option'
AsensorA
BsensorB
CsensorC
DsensorD
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up sensor variables and weights.
Using sensors not listed in the options.