Serial comunication with NodeMCU, arduino and blynk

Hello, I’m coming to this site to ask for help with my problem that i’m struggeling for hours. I would like to:

  • Change the value of V5 pin by button in Blynk app
  • Check if value equales 1
  • If yes, run serial comunication with arduino (and rest will be done on arduiono)

And here comes my problem: if i break code on parts: Blynk to node, node to arduino, it works, but when i put it togheter it can’t work. I would really appreciate if someone could help me.

Notes:

  • NodeMCU comunicates with arduino using function used in this code
  • Blynk app can change the value of V5, i have checked it by println(pinValue); and serial monitor
  • When that code is uploaded it seems that Blynk app loose conettion after a while

Hardware:

  • Arduino Uno
  • NodeMCU v3, ESP12-E

Code:

 #include<SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

SoftwareSerial s(3,1);

char auth[] = “kkk”;
char ssid[] = “xxx”;
char pass[] = “yyy”;

void setup()
{
// s.begin(9600);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
BLYNK_WRITE(V5)
{
int pinValue = param.asInt();
if (pinValue == 1)
{
transmit();
}
}
void loop() {
Blynk.run();
}

void transmit()
{
s.write(123);
delay(1000);
}

how it can't work?

Well, i don't know, that's why I'm asking. I mean the number 123 is not sent to the arduino, I can tell it because I got receiver code there, on arduino, that works perfectly when it's run on its own, only when I put together: code for serial communication and code for getting virtual pin value from Blynk app nothing is sent to arduino.

Deafult: Well, i don't know, that's why I'm asking. I mean the number 123 is not sent to the arduino, I can tell it because I got receiver code there, on arduino, that works perfectly when it's run on its own, only when I put together: code for serial communication and code for getting virtual pin value from Blynk app nothing is sent to arduino.

write(123) sends only one byte, a character {, not a string "123"

Yes I know I just write it in my answer as a shortcut, but code on arduino checks if value that is coming from nodemcu equals number 123, and its working but only when I use it separately

Deafult: Yes I know I just write it in my answer as a shortcut, but code on arduino checks if value that is coming from nodemcu equals number 123, and its working but only when I use it separately

why do you use SoftwareSerial on hardware Serial pins of esp8266? you begin() hw Serial and write to SoftwareSerial. and how are they wired together? do you use SoftwareSerial in Uno?