How to serial communication between node MCU and arduino
Posted:
Sun Jul 17, 2016 10:39 am
by ketsayay2538
Could anyone suggest How to communicate between node MCU and Arduino by using serial communication for send some char or int
Re: How to serial communication between node MCU and arduino
Posted:
Mon Jul 18, 2016 2:41 am
by f42ter
Could you please provide some more details.
This is not tested yet. I just start to play with my nodemcu.
If you code nodemcu using the Arduino IDE you may use
... fragment Arduino Board
// Arduino Code
#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8); // RX, TX on nodemcu
... fragment Arduino Board
... fragment nodemcu Board
// nodemcu Code
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 7); // RX, TX on Arduino
... fragment nodemcu Board
Connect 7 to 8 and 8 to 7 but you need a level converter (3.3v mode nodemcu) to protect the
nodemcu input pins.
At least you implement a communication protocol to send data between both boards.
f41*
Re: How to serial communication between node MCU and arduino
Posted:
Sun Jul 24, 2016 8:29 pm
by Andres Cotes
esp8266 nodemcu
#include <SoftwareSerial.h>
SoftwareSerial mySerial(13, 15); // RX, TX nodemcu
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
pinMode(13,OUTPUT);
}
void loop() {
char dato = Serial.read();
char dato2 = mySerial.read();
int tiempo = 100;
if (dato == 'S'){
mySerial.write(45);
digitalWrite(13, HIGH);
Serial.println("LETRA S ENVIADA");
}
if (dato == 'A'){
mySerial.write(58);
digitalWrite(13, LOW);
Serial.println("LETRA A ENVIADA");
}
if (dato2 == 58){
digitalWrite(13, HIGH);
Serial.println("LETRA S RECIBIDA");
}
if (dato2 == 45){
digitalWrite(13, LOW);
Serial.println("LETRA A RECIBIDA");
}
}