0
0
Arduinoprogramming~10 mins

SD card module wiring 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 include the SD card library.

Arduino
#include <[1]>
Drag options to blanks, or click blank then click option'
ASD.h
BWire.h
CSPI.h
DEEPROM.h
Attempts:
3 left
💡 Hint
Common Mistakes
Including SPI.h instead of SD.h
Forgetting to include any library
2fill in blank
medium

Complete the code to define the chip select pin for the SD card module.

Arduino
const int chipSelect = [1];
Drag options to blanks, or click blank then click option'
A4
B10
C13
D7
Attempts:
3 left
💡 Hint
Common Mistakes
Using pin 10 which is for SPI but not always CS
Using pin 13 which is the built-in LED pin
3fill in blank
hard

Fix the error in the SD card initialization code.

Arduino
if (!SD.[1](chipSelect)) {
  Serial.println("Initialization failed!");
  return;
}
Drag options to blanks, or click blank then click option'
Aopen
Bstart
Cbegin
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using init() or start() which do not exist
Using open() which is for files
4fill in blank
hard

Fill both blanks to create a file and write text to it.

Arduino
File myFile = SD.[1]("test.txt", [2]);
Drag options to blanks, or click blank then click option'
Aopen
BFILE_WRITE
CFILE_READ
Dbegin
Attempts:
3 left
💡 Hint
Common Mistakes
Using FILE_READ when writing is needed
Using begin as a function to open files
5fill in blank
hard

Fill all three blanks to write text to the file and close it.

Arduino
myFile.[1]("Hello, SD card!");
myFile.[2]();
Serial.[3]("File written successfully.");
Drag options to blanks, or click blank then click option'
Aprint
Bclose
Cprintln
Dbegin
Attempts:
3 left
💡 Hint
Common Mistakes
Using println() to write to the file
Forgetting to close the file