Probably if the voltage is OK! Post a link to it.
I used the Leonardo pinout to connect The Things UNO (which is based on the Leonardo) to a NRF24L01 module - code to transmit text is
// Leonardo > NRF24L01 transmitter test using a text string
// RP2040 connections
// RP2040 SPIO_SCK pin GP18 goes to NRF24L10_pin SCK
// RP2040 SPIO_RX pin GP16 goes to NRF24L10_pin MISO
// RP2040 SPIO_TX pin GP19 goes to NRF24L10_pin MOSI
// RP2040 pin SPIO_CSn GP17 to NRF24L10 CSN
// RP2040 pin GP20 to NRF24L10 CE
// RP2040 GND and 3.3V to NRF24L10 GND and VCC
// Leonardo connections
// Leonardo ICSP SCK pin 15 to NRF24L10_pin SCK
// Leonardo ICSP MISO pin 14 to NRF24L10_pin MISO
// Leonardo ICSP MOSI pin 16 to NRF24L10_pin MOSI
// Leonardo pin 10 to NRF24L10 CSN
// Leonardo pin 9 to NRF24L10 CE
// Leonardo GND and 3.3V to NRF24L10 GND and VCC
#include <SPI.h>
#include "RF24.h"
#define CE_PIN 9
#define CSN_PIN 10
bool radioNumber = 0;
RF24 radio(CE_PIN, CSN_PIN);
byte addresses[][6] = { "1Node", "2Node" };
void setup() {
Serial.begin(115200);
delay(2000);
Serial.println("\n\nLeonardo > NRF24L01 transmit text");
radio.begin();
if (radio.isChipConnected())
Serial.println("Transmitter NF24 connected to SPI");
else Serial.println("NF24 is NOT connected to SPI");
radio.setChannel(125);
radio.setPALevel(RF24_PA_MIN);
radio.powerUp();
radio.setDataRate(RF24_1MBPS);
//radio.setDataRate(RF24_250KBPS);
if (radioNumber) {
radio.openWritingPipe(addresses[1]);
radio.openReadingPipe(1, addresses[0]);
} else {
radio.openWritingPipe(addresses[0]);
radio.openReadingPipe(1, addresses[1]);
}
radio.stopListening();
//radio.setPayloadSize(sizeof(Struct1));
}
// loop transmiting data packet
void loop() {
static char testString[10] = "text 0";
radio.write(testString, sizeof(testString));
Serial.print("transmit ");
Serial.println(testString);
delay(1000);
testString[5]++;
}
serial output
Leonardo > NRF24L01 transmit text
Transmitter NF24 connected to SPI
transmit text 0
transmit text 1
transmit text 2
transmit text 3
transmit text 4
transmit text 5
receiver (running on a Nano)
Nano > NRF24L01 Receive text
Receiver NF24 connected to SPI
Test string: text 1
Test string: text 3
Test string: text 4
Test string: text 5
Test string: text 6
Test string: text 7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.