SENDING DATA BETWEEN ARDUINO TO ARDUINO OR ARDUINO TO NODE MCU
(WORKS FOR BOTH)
Use the following code in Sender side
#include <SoftwareSerial.h> // connect the 5 of esp to 5 of arduino
SoftwareSerial s(5,6); //connect the 6 of esp to 6 of arduino
void setup() {
s.begin(9600);
}
void loop() {
int data=50;
if(s.available()>0)
{
s.write(data);
}
}
SoftwareSerial s(5,6); //connect the 6 of esp to 6 of arduino
void setup() {
s.begin(9600);
}
void loop() {
int data=50;
if(s.available()>0)
{
s.write(data);
}
}
use following code on receiver side
#include <SoftwareSerial.h>
SoftwareSerial s(D6,D5);
float data;
void setup() {
Serial.begin(9600);
}
void loop() {
if (s.available()>0)
{
data=s.read();
Serial.println(data);
}
}
SoftwareSerial s(D6,D5);
float data;
void setup() {
Serial.begin(9600);
}
void loop() {
if (s.available()>0)
{
data=s.read();
Serial.println(data);
}
}