0

I am programming a RaspberryPi Pico with the Arduino IDE. Works pretty well, but now I try to control an nrf24l01 module.

My code compiles but I do not know on which pins the SPI bus has to be hocked up. I tried to connect to different pins according the pinout https://datasheets.raspberrypi.org/pico/Pico-R3-A4-Pinout.pdf (for example 2 sck, 3 miso, 4 mosi), but nothing worked so far.

Does anybody know what the default pins are or how to control them? I also would like to control other SPI hardware, for example a display.

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

const uint64_t address = 0x1; byte sendData[1];

#define CSN_PIN 5 #define CE_PIN 6 RF24 radio(CE_PIN, CSN_PIN);

byte counter = 0;

void setup()
{ Serial.begin(115200); Serial.println(“radio starting");

if (!radio.begin()) { Serial.println("radio hardware is not responding!!"); while (1) {} }
radio.openWritingPipe(address); }

void loop()
{ Serial.print("Counter: "); Serial.println(counter);

sendData[0] = counter;

radio.write( sendData, sizeof(sendData));

counter++; }

qubit
  • 370
  • 1
  • 4
  • 11

1 Answers1

4
  1. For Arduino-pico core

    ** MISO - pin GP16

    ** MOSI - pin GP19

    ** CS - pin GP17

    ** SCK - pin GP18

  2. Arduino-mbed core

    ** MISO - pin GP4

    ** MOSI - pin GP3

    ** CS - pin GP5

    ** SCK - pin GP2

khoih-prog
  • 451
  • 3
  • 6