I want to transfer analog readings i.e. variable values from a NodeMCU to an Arduino Uno so that on the Arduino side I can check those values using an if
condition and make a buzzer sound. Please help with the connections of the RX and TX pin wires and also with the code.
NODEMCU CODE:
int mq6 = A0;
int d = 0;
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
pinMode(mq6, INPUT);
Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
}
void loop() {
Blynk.run();
d = analogRead(mq6);
Serial.println();
Serial.print(d);
Blynk.virtualWrite(V0, d);
Serial1.println(String(d));
if (d > 500) {
Blynk.logEvent("warning_leakage", "Temp above 30 degree");
}
}
ARDUINO CODE:
void setup() {
// Serial Begin at 9600 Baud
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
int d = Serial1.parseInt();
Serial.println(d);
delay(100);
}
if (Serial1.available()) {
so it doesn't print a 0 every second