Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
MyEngineeringStuffs
Published © GPL3+

Serial Communication between NodeMCU and Arduino

Serial Communication between ESP2866-12 (NODE-MCU) and Arduino to increase the number of analog pins as my primary work.

BeginnerShowcase (no instructions)2 hours144,789
Serial Communication between NodeMCU and Arduino

Things used in this project

Story

Read more

Schematics

Arduino and Node MCU circuit

Arduino and Node MCU circuit

Code

Arduino_Code.ino

C/C++
#include <dht.h>
dht DHT;
int temp,humi;
#define DHT11_PIN A0
String str;
void setup(){
 Serial.begin(115200);
 Serial1.begin(115200);
 Serial.print(char(169)); // Copyright Symbol
 Serial.println(" Myengineeringstuffs.com");
 delay(2000);
}
void loop()
{
  DHT.read11(DHT11_PIN);
  humi=DHT.humidity;
  temp=DHT.temperature;
  Serial.print("H: ");
  Serial.print(humi); 
  Serial.print("% ");
  Serial.print(" T: ");
  Serial.print(temp); 
  Serial.print(char(176));
  Serial.println("C");
  str =String('H')+String(humi)+String('T')+String(temp);
  Serial1.println(str);
  delay(5000);
}

Node-MCU-Side.ino

C/C++
void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
}

void loop() { // run over and over
  if (Serial.available()) {
    Serial.write(Serial.read());
  }
}

Credits

MyEngineeringStuffs
13 projects โ€ข 71 followers
I ๐Ÿ˜ to help people, students are always FIRST, and Yes๐Ÿ‘‰https://paypal.me/pawanbehera1 you can buy me a COFFEE if U๐Ÿ˜ my WORK, NAMASTE ๐Ÿ™

Comments