2

I have troubles connecting a nRF24L01 transceiver to a Wemos D1 R2 board. I succeeded on an Arduino Uno. Does anyone know the pinout?

I used (same as with Uno):

D13 - SCK
D12 - MI
D11 - MO

D8 and D9 for CE and CSN

Code:

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

// NRF24 Radio #define CE_PIN 'D8' #define CSN_PIN 'D9'

RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

// NRF24 Radio radio.begin(); if (!radio.isChipConnected()) { Serial.println("ERROR: NRF24 Chip not connected"); } else { Serial.println("NRF24 Chip connected"); radio.setDataRate( RF24_250KBPS ); radio.setRetries(3,5); // delay, count radio.openWritingPipe(slaveAddress); }

Result: ERROR: NRF24 Chip not connected

If I use:

#define CE_PIN   8
#define CSN_PIN  9

then Wemos crashes (reboot exception (4)) so I tried with D, but I get a warning, maybe related:

warning: multi-character character constant [-Wmultichar]
   22 | RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
      |            ^~~~~~
 warning: multi-character character constant [-Wmultichar]
   22 | RF24 radio(CE_PIN, CSN_PIN); // Create a Radio 
dda
  • 1,595
  • 1
  • 12
  • 17
FredV
  • 21
  • 3

1 Answers1

1

Select Wemos D1 R2/mini in Tools menu in IDE. Then you can use the Dx names of the pins. Don't put them in quotes.

Since D8 is CS pin at the Uno pin 10 location, you can't use it as CE. And because esp8266 has less pin than Atmega328 of Uno, there is no pin D9. I recommend you to use pins D1 and D2 for CE and CSN.

RF24 radio(D1, D2);

Here you can read how the Dx pins are mapped to esp8266 pins and what is the common function of the pins.

enter image description here

Juraj
  • 18,264
  • 4
  • 31
  • 49