Problem of nodemcu with arduino

Hi. I am doing a project with nodemcu connected to Wifi and get RSSI value.
Is it possible for me to send the RSSI value to Arduino Uno? I need to display those RSSI value when Arduino Uno is running on the program.

Thank you.


Of course. The two can communicate just fine.

Thanks for reply. I need to clarify as i failed to let bith of them communicate via SPI. I was thinking is my arduino uno don't have any wifi compatibility so it fail to display rssi.but since you say the communication is fine, I will try again

Mind that you need level shifters between them unless you have a 3.3V Arduino. The NodeMCU pins are not 5V tolerant and may be destroyed by an Arduino driving a pin at 5V.

i follow this image connection.
my nodemcu is connected to laptop via micro USB. I did not connect Vin.

I am using this code for SPI communication.
code for Nodemcu

#include <ESP8266WiFi.h>        // Include the Wi-Fi library
#include <SPI.h>
const char* ssid     = "ID";         // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "password";     // The password of the Wi-Fi network

void setup() {
  Serial.begin(9600);         // Start the Serial communication to send messages to the computer
  WiFi.begin(ssid, password);             // Connect to the network
  Serial.print("Connecting to ");
  Serial.print(ssid); Serial.println(" ...");

  int i = 0;
  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    Serial.print(++i); Serial.print(' ');
  Serial.println("Connection established!");  
  Serial.print("IP address:\t");
  Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer

void loop() 

  long rssi = WiFi.RSSI();

code for Arduino uno

#include <SPI.h>

int RSSI;
volatile byte index;
volatile bool receivedone;  /* use reception complete flag */

void setup (void)
  Serial.begin (9600);
  SPCR |= bit(SPE);         /* Enable SPI */
  pinMode(MISO, OUTPUT);    /* Make MISO pin as OUTPUT */
  index = 0;
  receivedone = false;
  SPI.attachInterrupt();    /* Attach SPI interrupt */

void loop (void)
  if (receivedone)          
    receivedone = false;

// SPI interrupt routine
ISR (SPI_STC_vect)
  uint8_t oldsrg = SREG;
  char c = SPDR;
  SREG = oldsrg;

however, nodemcu is connected to wifi but its rssi could not display when Arduino is running.

You Arduino code is not complete, it won’t compile like this.

receivedone never gets set to true.

i change my arduino code to this.

[code#include <SPI.h>
int rssi;
volatile byte pos;
volatile boolean process_it;

void setup (void)
  Serial.begin (115200);   // debugging
  // turn on SPI in slave mode
  SPCR |= bit (SPE);

  // have to send on master in, *slave out*
  pinMode(MISO, OUTPUT);
  // get ready for an interrupt 
  pos = 0;   // buffer empty
  process_it = false;

  // now turn on interrupts

}  // end of setup

// SPI interrupt routine
ISR (SPI_STC_vect)
byte c = SPDR;  // grab byte from SPI Data Register
  // add to buffer if roo
  // example: newline means time to process buffer
  if (c == '\n')
    process_it = true;
}  // end of interrupt routine SPI_STC_vect

// main loop - wait for flag set in interrupt routine
void loop (void)
Serial.println (rssi);
    process_it = false;

}  // end of loop]

but it display all 0.
I have to set arduino uno to receive a list of RSSI value from Nodemcu.

You never set a value to the variable rssi, so the result is expected.

How can I set value to variable RSSI? The RSSI is kept changing as the NodeMcu connected to WiFi. I have to set Arduino uno receive RSSI while Nodemcu is connecting to Wifi router.

rssi = value;

where value is whatever value you receive over the SPI bus. I don't see you try to actually read the SPI anywhere. You only set a process_it bool to true in the ISR but don't do anything with that, either.

Thanks for reply. Actually I spent a lot of time in searching online, but all of them could not work. Could you share any useful source here?