0
0
Arduinoprogramming~10 mins

RF communication with nRF24L01 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 library needed for nRF24L01 communication.

Arduino
#include <[1]>
Drag options to blanks, or click blank then click option'
ARF24.h
BSPI.h
CnRF24L01.h
DWire.h
Attempts:
3 left
💡 Hint
Common Mistakes
Including SPI.h only does not provide nRF24L01 functions.
Using nRF24L01.h is not the correct library name.
Wire.h is for I2C communication, not RF.
2fill in blank
medium

Complete the code to create an RF24 object with CE pin 9 and CSN pin 10.

Arduino
RF24 radio([1], [2]);
Drag options to blanks, or click blank then click option'
A9
B10
C7
D8
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping CE and CSN pins.
Using pins not connected to the module.
3fill in blank
hard

Fix the error in the code to start the radio and check if it is available.

Arduino
void setup() {
  Serial.begin(9600);
  if (!radio.[1]()) {
    Serial.println("Radio hardware not responding!");
  }
}
Drag options to blanks, or click blank then click option'
Astart
Bbegin
CbeginTransmission
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' or 'init' which are not valid RF24 methods.
Using 'beginTransmission' which is for I2C or SPI devices.
4fill in blank
hard

Fill both blanks to set the radio to writing mode and open a writing pipe with address '0xF0F0F0F0E1'.

Arduino
radio.[1]();
radio.[2](0xF0F0F0F0E1ULL);
Drag options to blanks, or click blank then click option'
AstopListening
BstartListening
CopenWritingPipe
DopenReadingPipe
Attempts:
3 left
💡 Hint
Common Mistakes
Using startListening before sending data.
Opening a reading pipe instead of writing pipe for sending.
5fill in blank
hard

Fill all three blanks to send the string 'Hello' and check if the transmission was successful.

Arduino
const char text[] = "Hello";
bool [1] = radio.[2](text, sizeof(text));
if ([3]) {
  Serial.println("Sent successfully");
} else {
  Serial.println("Send failed");
}
Drag options to blanks, or click blank then click option'
Asuccess
Bwrite
Dsend
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'send' which is not a method of RF24.
Not checking the return value of write.