Transmitter Code in Nano:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN pins
const byte address[6] = "00001"; // Address of the receiver
const uint64_t pipes = 0xF0F0F0F0E1LL;
void setup()
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipes);
radio.setChannel(100);
radio.stopListening();
}
void loop() {
int dataToSend[13] = {0,12,11,0,0,121,50,11,170,111,0,50,1};
radio.write(&dataToSend, sizeof(dataToSend));
delay(1000);
}
Receiver Code in Pico:
import utime
from machine import Pin, SPI
from nrf24l01 import NRF24L01
#addresses
pipes = b'\xE1\xF0\xF0\xF0\xF0'
#turning on picos built-in LED to indicate that power is on
led = Pin(25, Pin.OUT)
led.value(1)
print('Pico RX Starting')
#setting up nrf24l01 object
spi = SPI(0, sck=Pin(6), mosi=Pin(7), miso=Pin(4))
csn = Pin(14, mode=Pin.OUT, value=1)
ce = Pin(17, mode=Pin.OUT, value=0)
nrf = NRF24L01(spi, csn, ce, channel=100, payload_size=32)
#opening listening pipe
nrf.open_rx_pipe(0, pipes)
nrf.start_listening()
print('RX Ready. Waiting for packets...')
while True:
utime.sleep(1)
#checking for a message on the nrf24l01
if nrf.any():
print('Received something!:')
package = nrf.recv()
msg = package.decode()[0:9]
print(msg)
The receiver works with another nano but can't communicate with pico..
please Help me!
