Hello all, I'm working on a project where an ESP8266 (NODE MCU) acts as a base module for a group of arduino modules communicating via the NRF transceiver. Basically the Arduinos send the ESP data which then is sent to a server through the wifi chip on the ESP.
I have successfully gotten the ESP to act as a receiver and the Arduino (one for now, testing only) as the transmitter. But not in reverse. Any time I try to get the ESP to receive anything it simply doesn't, and I can't figure out why.
I have been working with this tutorial by Robin2 (thanks a million btw, helped me so much). And I got a barebones communication between the two working one way but not the other.
Here is the Arduino code acting as the Transmitter
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
byte address[6] = "one";
int moist = 5;
//int ackData[2] = {-1,-1};
void setup() {
Serial.begin(9600);
radio.begin();
radio.setDataRate( RF24_250KBPS );
//radio.enableAckPayload();
radio.setRetries(3,5); // delay, count
radio.openWritingPipe(address);
radio.stopListening();
}
void loop() {
int moist = analogRead(A1);
radio.write( &moist, sizeof(moist) ); //send moisture sensor readout
delay(1000);
}
And here is the ESP8266 code acting as the Receiver
//RADIO
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(2, 15); // CE, CSN
byte address[6] = "one";
//RADIO
//int ackData[2] = {109, -40};
void setup(void) {
pinMode(2,OUTPUT);
Serial.begin(9600);
//RADIO
radio.begin();
radio.setDataRate( RF24_250KBPS );
radio.openReadingPipe(1, address);
//radio.enableAckPayload();
radio.startListening();
//radio.writeAckPayload(1, &ackData, sizeof(ackData));
//RADIO
}
void loop(void) {
//RADIO
if (radio.available()) {
//char text[32] = "";
int text = 0;
radio.read(&text, sizeof(text));
Serial.println(text);
digitalWrite(2,LOW); // blink led to physically show reception
delay(200);
digitalWrite(2,HIGH);
}
//RADIO
}
The acknowledge code is commented out because that breaks all functionality of the communication and sends a line of numbers that don't make sense but do change when I change the value of the moisture sensor. That is a problem for later though. I'm trying to just get the ESP to SEND information and the Arduino to RECEIVE it.
I have verified multiple times that the wiring is good, the CE and CSN pins are changed when I switch the code and roles for the boards. I don't get a single error. So I'm at a loss here.
If anyone can provide some insight or help or tell me I am blind and missed a huge piece please let me know.
Thank you for your time
Edit: its the NODE MCU, thanks ieee488 I forgot