0
0
Arduinoprogramming~10 mins

Why data logging matters in Arduino - Test Your Understanding

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

Complete the code to start serial communication for data logging.

Arduino
void setup() {
  Serial.begin([1]);
}
Drag options to blanks, or click blank then click option'
A19200
B115200
C4800
D9600
Attempts:
3 left
💡 Hint
Common Mistakes
Using a baud rate too slow for efficient data logging.
2fill in blank
medium

Complete the code to write sensor data to the serial monitor.

Arduino
void loop() {
  int sensorValue = analogRead(A0);
  Serial.[1](sensorValue);
  delay(1000);
}
Drag options to blanks, or click blank then click option'
Aprintln
Bprint
Cwrite
Dread
Attempts:
3 left
💡 Hint
Common Mistakes
Using Serial.print without new lines, causing cluttered output.
3fill in blank
hard

Fix the error in the code to correctly open the SD card for logging.

Arduino
#include <SD.h>
const int chipSelect = 10;

void setup() {
  if (!SD.[1](chipSelect)) {
    Serial.println("SD card failed or not present");
    return;
  }
  Serial.println("SD card initialized.");
}
Drag options to blanks, or click blank then click option'
Abegin
Bopen
Cstart
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using open() or init() which are not valid SD library methods.
4fill in blank
hard

Fill both blanks to write data to a file on the SD card.

Arduino
File dataFile = SD.[1]("log.txt", [2]);
if (dataFile) {
  dataFile.println("Sensor data");
  dataFile.close();
}
Drag options to blanks, or click blank then click option'
Aopen
BFILE_WRITE
Cread
DFILE_READ
Attempts:
3 left
💡 Hint
Common Mistakes
Using FILE_READ when trying to write data.
5fill in blank
hard

Fill all three blanks to create a dictionary-like structure for logged data.

Arduino
struct DataEntry {
  int [1];
  float [2];
  char [3][20];
};
Drag options to blanks, or click blank then click option'
Aid
Btemperature
Ctimestamp
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong data types or confusing variable names.