This is my first project with any sort of development board and it has been a blast so far.
I am running into some issues, however, while trying to send serial data from my Uno to a NodeMCU board.
I have the following connections:
Uno Rx to NMcu Tx
Uno Tx to NMcu Rx
Uno GND to NMcu GND
microUSB from computer to power NMcu
usb from computer to power Uno
EDIT: after some suggestions, I have also tried the following.
Uno DigitalPin 5 to NMcu D6
Uno DigitalPin 6 to NMcu D5
Uno GND to NMcu GND
microUSB from computer to power NMcu
usb from computer to power Uno
With the following code:
// UNO sender Code
#include <SoftwareSerial.h>
SoftwareSerial toESP(0, 1); //Rx, Tx (also tried 5,6)
void setup()
{
Serial.begin(115200);
toESP.begin(9600);
}
void loop()
{
Serial.println("sending");
toESP.println("message from Nano");
delay(1000);
}
// NodeMCU receiver code
#include <SoftwareSerial.h>
SoftwareSerial fromNano(3, 2); //Rx, Tx (also tried D5, D6)
void setup()
{
Serial.begin(115200);
fromNano.begin(9600);
}
void loop()
{
if (fromNano.available())
{
char inChar = fromNano.read();
Serial.print(inChar);
}
else {
Serial.println("not available");
}
delay(2000);
}
I can pull up a serial monitor from both and see the UNO sending data (the TX led also blinks on the uno).
The NodeMCU code never satisfies the fromNano.available
condition.
Is there anything I am overlooking that is causing this not to work? I've attached a picture of my connections as well.
Any help is much appreciated.