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
