Old code cannot work on new Blynk

I’m already using this code before blynk change to new one and it’s work just fine before the old app shut down.

I’m already change some line so it can connected to the new app but the virtual LCD keep blinking and didn’t transfer any data to virtual LCD even the button didn’t work either. I’m using ESP8266 to arduino for multiple sensors.

this is the old one

#define BLYNK_PRINT Serial

#include <ESP8266wifi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;

char auth[] = "xxx";
char ssid[] = "xxx";
char pass[] = "xxx";

float sistol,diastol,heart,temperature;
int spo2,gsr;
String result="";

WidgetLCD lcd(V0);
WidgetLCD lcd1(V1);

// for heart button
BLYNK_WRITE(V2){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("H");
}

// for gsr button
BLYNK_WRITE(V3){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("G");
}

// for temp  button
BLYNK_WRITE(V4){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("T");
}

// for blood press button
BLYNK_WRITE(V5){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("P");
}

// for startting the pressure
BLYNK_WRITE(V7){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("f");
  
}


// for reset button
BLYNK_WRITE(V6){
  int pinValue = param.asInt();

if( pinValue == 1) { 

  sistol=0;
  diastol=0;
  heart=0;
  temperatur=0;
  spo2=0;
  gsr=0;
  result="";
  Serial.println("R");
}

}


void tasktimer(){
  
  lcd.clear();
  lcd1.clear();
   
  lcd.print(0, 0, "H:"+String(heart)); 
  lcd.print(9, 0, "S:"+String(spo2)); 
  
  lcd.print(0, 1, "T:"+String(temperatur)); 
  lcd.print(9, 1, "G:"+String(gsr)); 
  
  
  lcd1.print(0, 0, "S" + String(sistol) + "/" + "D" + String(diastol)); 
  lcd1.print(0, 1, "HASIL:");

  }
    
}

void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  
  timer.setInterval(1000, tasktimer); // setting timer per detik
  
  Serial.println("ready ");
}

String in="";
void loop()
{
  Blynk.run();
  timer.run();

 if(Serial.available()){
  char c = Serial.read();
  if(isDigit(c) || c=='.' || c=='-') in+=c;
  if(c==' ') in="";

  if(c=='h'){
    
    heart = in.toFloat();
    in = "";
  }

  if(c=='o'){
    
    spo2 = in.toInt();
    in = "";
  }

  if(c=='g'){
    
    gsr = in.toInt();
    in = "";
  }
  
  if(c=='t'){
   
    temperatur = in.toFloat();
    in = "";
  }

  if(c=='s'){
    
    sistol = in.toFloat();
    in = "";
  }

  if(c=='d'){
    
    diastol = in.toFloat();
    in = "";
  }

 }

} 
```cpp

this is the new one

#define BLYNK_TEMPLATE_ID " "
#define BLYNK_DEVICE_NAME " "
#define BLYNK_AUTH_TOKEN " "
#define BLYNK_PRINT Serial

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

char ssid[] = "***";
char pass[] = "***";

float sistol,diastol,heart,temperature;
int spo2,gsr;
String result="";

BlynkTimer timer;

WidgetLCD lcd(V0);
WidgetLCD lcd1(V1);

// for heart button
BLYNK_WRITE(V2){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("H");
}

// for gsr button
BLYNK_WRITE(V3){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("G");
}

// for temp button
BLYNK_WRITE(V4){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("T");
}

// for blood press button
BLYNK_WRITE(V5){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("P");
}

// for startting the pressure
BLYNK_WRITE(V7){
  int pinValue = param.asInt();
  if( pinValue == 1 ) Serial.println("f");
  
}

// for reset button
BLYNK_WRITE(V6){
  int pinValue = param.asInt();
  if( pinValue == 1) { 

  sistol=0;
  diastol=0;
  heart=0;
  temperature=0;
  spo2=0;
  gsr=0;
  Serial.println("R");
  
 }

}

void tasktimer()
{
  lcd.clear();
  lcd1.clear();
   
  lcd.print(0, 0, "H:"+String(heart)); 
  lcd.print(9, 0, "S:"+String(spo2)); 
  
  lcd.print(0, 1, "T:"+String(temperature)); 
  lcd.print(9, 1, "G:"+String(gsr)); 
  
  
  lcd1.print(0, 0, "S" + String(sistol) + "/" + "D" + String(diastol)); 
  lcd1.print(0, 1, "HASIL:");
  
}

void setup()
{
  Serial.begin(115200);

  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
 
  timer.setInterval(1000, tasktimer);
  
  Serial.println("ready ");
}

String in="";
void loop() 
{
  Blynk.run();
  timer.run();

 if(Serial.available()){
  char c = Serial.read();
  if(isDigit(c) || c=='.' || c=='-') in+=c;
  if(c==' ') in="";

  if(c=='h'){
    
    heart = in.toFloat();
    in = "";
  }

  if(c=='o'){
    
    spo2 = in.toInt();
    in = "";
  }

  if(c=='g'){
    
    gsr = in.toInt();
    in = "";
  }
  
  if(c=='t'){
   
    temperature = in.toFloat();
    in = "";
  }

  if(c=='s'){
    
    sistol = in.toFloat();
    in = "";
  }

  if(c=='d'){
    
    diastol = in.toFloat();
    in = "";
  }

 }
 
}
```ccp

You’re missing three lines of firmware configuration from the beginning of your new sketch.

Pete.

my bad, i copied the wrong code on the new one, thankyou for reminding me sir

UPDATE: After take a closer look, turn out i didnt change serial communication value on my arduino code from Serial.begin(9600); to
Serial.begin(115200);

I’m still left with some questions, why the baud rate between Node MCU and arduino only works on 115200 but can not works when it is 9600? Is It because the new Blynk cannot work on 9600 like before?

Note: before changing my arduino baud rate, i’m already tried the 9600 baud rate on my Node MCU but it didn’t work

To be honest, I’m surprised it works at any baud rate. You’re using your serial port for debug messages as well as for communication between the two devices.

The hardware setup that you’ve adopted is extremely clunky and would be my last choice for something like this. You’d be far better using a single IoT enabled device to handle your sensors and the communication with Blynk.

If an ESP8266 or ESP32 board doesn’t have sufficient GPIO or Analog then adding multiplexer would be my approach. I certainly wouldn’t go for device to device comms via serial.

Pete.

yeah honestly, i admit its kinda mess but it still work other way. But i’m open to any suggestion, is there something i can alter without adding any more device/items, because one of the sensor(mpx5050) i’m using is supported by valve and i dont think ESP82266 have enough for supplying it and another sensors.

If you have a device that draws quite a lot of power then you should have a separate power supply, which shares the same ground as the power supply for your device.

This is just as true for the Uno/Mega as it is for the ESP range of boards.

Pete.