...
2- Use the following ESP32 pin configuration for wairing pairing ESP32 to nRF24L01+
CE -> GPIO17 GPIO
CSN -> GPIO05 VSPI SS
MISO -> GPIO19 VSPI MISO
MOSI -> GPIO23 VSPI MOSI
CLK -> GPIO18 VSPI CLK
IRQ-> unconnected
Sample TX Code
Code Block |
---|
#include <SPI.h> #include "RF24.h" /* * Commands * B - Left * C - Driver Door * D - Right * E - Back * F - Passenger Door? * G - Forward * * Sample* TransmitterPinout * * CLK 14 18 * MOSI 1323 * MISO 1219 * CS 155 * CE 817 */ #define CE_PIN 817 #define CS_PIN 155 RF24 radio(CE_PIN,CS_PIN); //const byte addressespipes[2][6] = {"i8-00001", "I8-00001"}; //const byte addresses[2][6] = {{'i','8','-','0','0','1'},{'I','8','-','0','0','1'}}; const byte addresses[2][6] = {{0x69,0x38,0x2d,0x30,0x30,0x31},{0x49,0x38,0x2d,0x30,0x30,0x31}}; char buf[1]; int bufsize=1; void setup() { Serial.begin(115200); Serial.println(F("\n\ni8 Tx Started")); Serial.println(F("*** PRESS 'B-G' to represent button")); radio.begin(); // Set the PA Level low to prevent power supply related issues. radio.setPALevel(RF24_PA_LOW); radio.setRetries(15,15); radio.setPayloadSize(8); radio.setDataRate(RF24_1MBPS); radio.setAutoAck(1); // Ensure autoACK is enabled radio.openWritingPipe(addresses[0]); radio.stopListening(); } void loop() { // process serial requests if ( Serial.available() ) { char c = toupper(Serial.read()); //'B', 'C', 'D', 'E', 'F', 'G' if(c >= 'B' && c <= 'G'){ Serial.printf("> %c \n",c); buf[0]=c; int v = radio.write(&buf, bufsize); buf[0]=tolower(c); v = radio.write(&buf, bufsize); } } } |
...