user27347386
user27347386

Reputation: 1

How to use the nRF24L01 module with the RP2040 Zero?

I am working on a project where I need to use the nRF24L01 radio module with an RP2040 Zero microcontroller. I have already installed the RF24 library in the Arduino IDE and have connected the hardware as follows:

MISO: Pin 12
MOSI: Pin 11
SCK: Pin 10
CSN: Pin 13
CE: Pin 9

Here’s the code I’ve written for receiving data:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

// Definiere die Pins für CE und CSN
const int CE_PIN = 9;
const int CSN_PIN = 13;

// Erstelle ein RF24-Objekt
RF24 radio(CE_PIN, CSN_PIN);

// Adresse für das Datenübertragungsrohr
const byte address[6] = "00001";

// Variable zum Speichern der empfangenen Daten
char receivedData[32];

void setup() {
  Serial.begin(9600);  // Starte die serielle Kommunikation
  radio.begin();       // Initialisiere das Funkmodul
  radio.openReadingPipe(0, address);  // Öffne den Lese-Pipe 0 mit der angegebenen Adresse
  radio.setPALevel(RF24_PA_MIN);      // Setze die Leistung auf Minimum
  radio.startListening();             // Starte den Empfang
}

void loop() {
  // Überprüfe, ob Daten empfangen wurden
  if (radio.available()) {
    radio.read(&receivedData, sizeof(receivedData)); // Lese die empfangenen Daten
    Serial.print("Empfangen: ");
    Serial.println(receivedData); // Zeige die empfangenen Daten auf dem seriellen Monitor an
  }
  delay(1000);
}

My questions are:

Upvotes: -1

Views: 194

Answers (1)

james jordan
james jordan

Reputation: 9

I have got it to work

MISO pin 4
SCK pin 6
MOSI pin 7
CE pin 5
Csn pin 8
RF24 radio(5,8);

Upvotes: -1

Related Questions