Bird
0
0
Arduinoprogramming~10 mins

SPI library usage 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 initialize SPI communication.

Arduino
#include <SPI.h>

void setup() {
  SPI.[1]();
}

void loop() {
  // Your code here
}
Drag options to blanks, or click blank then click option'
Aopen
Bbegin
Cinit
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using start() or init() instead of begin().
2fill in blank
medium

Complete the code to send a byte of data over SPI.

Arduino
byte data = 0x42;
SPI.[1](data);
Drag options to blanks, or click blank then click option'
Atransfer
Bsend
Cwrite
DwriteByte
Attempts:
3 left
💡 Hint
Common Mistakes
Using send() or write() which are not SPI library functions.
3fill in blank
hard

Fix the error in setting the SPI clock divider to 16.

Arduino
SPI.[1](SPI_CLOCK_DIV16);
Drag options to blanks, or click blank then click option'
AsetClockDivider
BclockDivider
CsetClock
DsetClockSpeed
Attempts:
3 left
💡 Hint
Common Mistakes
Using clockDivider() or setClock() which do not exist.
4fill in blank
hard

Fill both blanks to set SPI data mode and bit order.

Arduino
SPI.[1](SPI_MODE0);
SPI.[2](MSBFIRST);
Drag options to blanks, or click blank then click option'
AsetDataMode
BsetBitOrder
CsetClockDivider
DbeginTransaction
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing setClockDivider() with data mode or bit order functions.
5fill in blank
hard

Fill all three blanks to start an SPI transaction with settings.

Arduino
SPI.[1](SPISettings(4000000, [2], [3]));
Drag options to blanks, or click blank then click option'
AbeginTransaction
BMSBFIRST
CSPI_MODE0
DendTransaction
Attempts:
3 left
💡 Hint
Common Mistakes
Using endTransaction() instead of beginTransaction() to start.