Read 4x Loadcell (4xHX711 + Nodemcu) Not Working Blynk

Hello, I’m developing a project to use in my garage and I’m stuck somewhere.
Let me explain why I want to use this system. We are making improvements on our cars in our garage

Weight changes on the vehicle are important to us. Therefore, we need to obtain and evaluate information from 4 load cells separately. In this way, it can be ensured that 4 tires press on the ground with equal weight. If we can achieve this, it will allow the car to hold the ground more efficiently.

I set up the system as a small demo.

With the codes below, the system works on the Arduino IDE serial monitor as I want.

#include <HX711_ADC.h>
#if defined(ESP8266)|| defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif

//pins:
const int HX711_dout_LF = 12; //mcu > LF dout pin
const int HX711_sck_LF = 14; //mcu > LF sck pin
const int HX711_dout_RF = 4; //mcu > RF dout pin
const int HX711_sck_RF = 0; //mcu > RF sck pin
const int HX711_dout_LR = 13; //mcu > LR dout pin
const int HX711_sck_LR = 15; //mcu > LR sck pin
const int HX711_dout_RR = 5; //mcu > RR dout pin
const int HX711_sck_RR = 16; //mcu > RR sck pin

//HX711 constructor (dout pin, sck pin)
HX711_ADC LoadCell_LF(HX711_dout_LF, HX711_sck_LF); //Left Front
HX711_ADC LoadCell_RF(HX711_dout_RF, HX711_sck_RF); //Right Front
HX711_ADC LoadCell_LR(HX711_dout_LR, HX711_sck_LR); //Left Rear
HX711_ADC LoadCell_RR(HX711_dout_RR, HX711_sck_RR); //Right Rear 

const int calVal_eepromAdress_LF = 0; // eeprom adress for calibration value load cell LF (4 bytes)
const int calVal_eepromAdress_RF = 4; // eeprom adress for calibration value load cell RF (4 bytes)
const int calVal_eepromAdress_LR = 8; // eeprom adress for calibration value load cell LR (4 bytes)
const int calVal_eepromAdress_RR = 12; // eeprom adress for calibration value load cell RR (4 bytes)
unsigned long t = 0;


void setup() {
  
  Serial.begin(115200);
  delay(2000);
  Serial.println();
  Serial.println("Starting...");

  float calibrationValue_LF; // calibration value load cell LF
  float calibrationValue_RF; // calibration value load cell RF
  float calibrationValue_LR; // calibration value load cell LR
  float calibrationValue_RR; // calibration value load cell RR

  calibrationValue_LF = 399.16; // uncomment this if you want to set this value in the sketch
  calibrationValue_RF = 385.84; // uncomment this if you want to set this value in the sketch
  calibrationValue_LR = 349.70; // uncomment this if you want to set this value in the sketch
  calibrationValue_RR = 396.19; // uncomment this if you want to set this value in the sketch

  #if defined(ESP8266) || defined(ESP32)
  //EEPROM.begin(512); // uncomment this if you use ESP8266 and want to fetch the value from eeprom
#endif
  //EEPROM.get(calVal_eepromAdress_LF, calibrationValue_LF); // uncomment this if you want to fetch the value from eeprom
  //EEPROM.get(calVal_eepromAdress_RF, calibrationValue_RF); // uncomment this if you want to fetch the value from eeprom
  //EEPROM.get(calVal_eepromAdress_LR, calibrationValue_LR); // uncomment this if you want to fetch the value from eeprom
  //EEPROM.get(calVal_eepromAdress_RR, calibrationValue_RR); // uncomment this if you want to fetch the value from eeprom

  LoadCell_LF.begin();
  LoadCell_RF.begin();
  LoadCell_LR.begin();
  LoadCell_RR.begin();
  unsigned long stabilizingtime = 5000; // tare preciscion can be improved by adding a few seconds of stabilizing time
  boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
  byte loadcell_LF_rdy = 0;
  byte loadcell_RF_rdy = 0;
  byte loadcell_LR_rdy = 0;
  byte loadcell_RR_rdy = 0;
  while ((loadcell_LF_rdy + loadcell_RF_rdy + loadcell_LR_rdy + loadcell_RR_rdy) < 2) { //run startup, stabilization and tare, both modules simultaniously
    if (!loadcell_LF_rdy) loadcell_LF_rdy = LoadCell_LF.startMultiple(stabilizingtime, _tare);
    if (!loadcell_RF_rdy) loadcell_RF_rdy = LoadCell_RF.startMultiple(stabilizingtime, _tare);
    if (!loadcell_LR_rdy) loadcell_LR_rdy = LoadCell_LR.startMultiple(stabilizingtime, _tare);
    if (!loadcell_RR_rdy) loadcell_RR_rdy = LoadCell_RR.startMultiple(stabilizingtime, _tare);
  }
  if (LoadCell_LF.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 no.LF wiring and pin designations");
  }
   if (LoadCell_RF.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 no.RF wiring and pin designations");
  }
   if (LoadCell_LR.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 no.LR wiring and pin designations");
  }
  if (LoadCell_RR.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 no.RR wiring and pin designations");
  }
  LoadCell_LF.setCalFactor(calibrationValue_LF); // user set calibration value (float)
  LoadCell_RF.setCalFactor(calibrationValue_RF); // user set calibration value (float)
  LoadCell_LR.setCalFactor(calibrationValue_LR); // user set calibration value (float)
  LoadCell_RR.setCalFactor(calibrationValue_RR); // user set calibration value (float)
  Serial.println("Startup is complete");
}

void loop() {

  static boolean newDataReady = 0;
  const int serialPrintInterval = 2000; //increase value to slow down serial print activity

  // check for new data/start next conversion:
  if (LoadCell_LF.update()) newDataReady = true;
  LoadCell_RF.update();
  LoadCell_LR.update();
  LoadCell_RR.update();

  LoadCell_LF.update();
  if (LoadCell_RF.update()) newDataReady = true;
  LoadCell_LR.update();
  LoadCell_RR.update();

  LoadCell_LF.update();
  LoadCell_RF.update();
  if (LoadCell_LR.update()) newDataReady = true;
  LoadCell_RR.update();

  LoadCell_LF.update();
  LoadCell_RF.update();
  LoadCell_LR.update();
  if (LoadCell_RR.update()) newDataReady = true;

  //get smoothed value from data set
  if ((newDataReady)) {
    if (millis() > t + serialPrintInterval) {
      
      float LF = LoadCell_LF.getData(); // Left Front Tire Weight
      float RF = LoadCell_RF.getData(); // Right Front Tire Weight
      float LR = LoadCell_LR.getData(); // Left Rear Tire Weight
      float RR = LoadCell_RR.getData(); // Right Rear Tire Weight

      S1 = S2 + S3 + S4 + S5; // Total Weight
      S2 = LF / 1000; // Left Front Tire Weight
      S3 = RF / 1000; // Right Front Tire Weight
      S4 = LR / 1000; // Left Rear Tire Weight
      S5 = RR / 1000; // Right Rear Tire Weight
      S6 = S2 + S3; // Total Front Weight
      S7 = S6 / S1; // Total Front Rate
      S8 = S4 + S5; // Total Rear Weight
      S9 = S8 / S1; // Total Rear Rate
      S10 = S2 + S4; // Left Side Total Weight
      S11 = S10 / S1; // Left Side Total Rate
      S12 = S3 + S5; // Right Side Total Weight
      S13 = S12 / S1; // Right Side Total Rate     
      S14 = S3 + S4; // RF x LR Cross Weight (Wedge)   
      S15 = S14 / S1; // RF x LR Cross Rate
      S16 = S14 - S17; // RF x LR Pounds
      S17 = S2 + S5; // LF x RR Cross Weight 
      S18 = S17 / S1; // LF x RR Cross Rate
      S19 = S17 - S14; // LF x RR Pounds
      S20 = S10 * S6; // LF Target Tire Weight
      S21 = S20 - S2; // LF Weight Bias
      S22 = S12 * S6; // RF Target Tire Weight
      S23 = S22 - S3; // RF Weight Bias   
      S24 = S10 * S8; // LR Target Tire Weight
      S25 = S24 - S4; // LR Weight Bias     
      S26 = S12 * S8; // RR Target Tire Weight
      S27 = S26 - S5; // RR Weight Bias   
      S28 = S4 - S5; // Bite        
      S29 = S24 - S26; // Bite Target 

      Serial.println("...");
      Serial.print("Total Weight: ");
      Serial.print(S1);
      Serial.println("kg");
      Serial.print("Left Front Tire Weight: ");
      Serial.print(S2);
      Serial.println("kg");
      Serial.print("Right Front Tire Weight: ");
      Serial.print(S3); 
      Serial.println("kg");
      Serial.print("Left Rear Tire Weight: ");
      Serial.print(S4);
      Serial.println("kg");
      Serial.print("Right Rear Tire Weight: ");
      Serial.print(S5);
      Serial.println("kg");

      Serial.print("Bite: ");
      Serial.print(S28);
      Serial.println("kg");

      
      Serial.println("...");
      Serial.print("Total Front Weight: ");
      Serial.print(S6);
      Serial.println("kg");
      Serial.print("Total Front Rate: ");
      Serial.print(S7);
      Serial.println("%");

      Serial.print("Total Rear Weight: ");
      Serial.print(S8);
      Serial.println("kg");
      Serial.print("Total Rear Rate: ");
      Serial.print(S9);
      Serial.println("%");

      Serial.print("Left Side Total Weight: ");
      Serial.print(S10);
      Serial.println("kg");
      Serial.print("Left Side Total Rate: ");
      Serial.print(S11);
      Serial.println("%");

      Serial.print("Right Side Total Weight: ");
      Serial.print(S12);
      Serial.println("kg");
      Serial.print("Right Side Total Rate: ");
      Serial.print(S13);
      Serial.println("%");


      Serial.println("...");
      Serial.print("RF + LR Cross Weight (Wedge): ");
      Serial.print(S14);
      Serial.println("kg");
      Serial.print("RF + LR Cross Rate: ");
      Serial.print(S15);
      Serial.println("%");
      Serial.print("RF + LR Pounds Over/Under: ");
      Serial.print(S16);
      Serial.println("kg");

      Serial.print("LF + RR Cross Weight: ");
      Serial.print(S17);
      Serial.println("kg");
      Serial.print("LF + RR Cross Rate: ");
      Serial.print(S18);
      Serial.println("%");
      Serial.print("LF + RR Pounds Over/Under: ");
      Serial.print(S19);
      Serial.println("kg");


      Serial.println("...");
      Serial.print("Left Front Tire Target Weight: ");
      Serial.print(S20);
      Serial.println("kg");
      Serial.print("LF Weight Bias: ");
      Serial.print(S21);
      Serial.println("kg");

      Serial.print("Right Front Tire Target Weight: ");
      Serial.print(S22);
      Serial.println("kg");
      Serial.print("RF Weight Bias: ");
      Serial.print(S23);
      Serial.println("kg");

      Serial.print("Left Rear Tire Target Weight: ");
      Serial.print(S24);
      Serial.println("kg");
      Serial.print("LR Weight Bias: ");
      Serial.print(S25);
      Serial.println("kg");

      Serial.print("Right Rear Tire Target Weight: ");
      Serial.print(S26);
      Serial.println("kg");
      Serial.print("RR Weight Bias: ");
      Serial.print(S27);
      Serial.println("kg");

      Serial.print("Bite: ");
      Serial.print(S29);
      Serial.println("kg");

     
      newDataReady = 0;
      t = millis();
    }
  }

  // receive command from serial terminal, send 't' to initiate tare operation:
  if (Serial.available() > 0) {
    char inByte = Serial.read();
    if (inByte == 't') {
      LoadCell_LF.tareNoDelay();
      LoadCell_RF.tareNoDelay();
      LoadCell_LR.tareNoDelay();
      LoadCell_RR.tareNoDelay();
    }
  }

  //check if last tare operation is complete
  if (LoadCell_LF.getTareStatus() == true) {
    Serial.println("Tare load cell LF complete");
  }
   if (LoadCell_RF.getTareStatus() == true) {
    Serial.println("Tare load cell RF complete");
  }
   if (LoadCell_LR.getTareStatus() == true) {
    Serial.println("Tare load cell LR complete");
  }
  if (LoadCell_RR.getTareStatus() == true) {
    Serial.println("Tare load cell RR complete");
  }

}

I get an error when I want to send information to virtual pins using the codes below. I did not understand what the problem was. It gives an error when I send information with floats. If I send a constant value instead of float I can read it from the application (e.g. 1000)

#define BLYNK_TEMPLATE_ID           "XXX"
#define BLYNK_DEVICE_NAME           "XXX"
#define BLYNK_AUTH_TOKEN            "XXX"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "XXX";
char pass[] = "XXX";
BlynkTimer timer;


#include <HX711_ADC.h>
#if defined(ESP8266)|| defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif


//pins:
const int HX711_dout_LF = 12; //mcu > LF dout pin
const int HX711_sck_LF = 14; //mcu > LF sck pin
const int HX711_dout_RF = 4; //mcu > RF dout pin
const int HX711_sck_RF = 0; //mcu > RF sck pin
const int HX711_dout_LR = 13; //mcu > LR dout pin
const int HX711_sck_LR = 15; //mcu > LR sck pin
const int HX711_dout_RR = 5; //mcu > RR dout pin
const int HX711_sck_RR = 16; //mcu > RR sck pin

//HX711 constructor (dout pin, sck pin)
HX711_ADC LoadCell_LF(HX711_dout_LF, HX711_sck_LF); //Left Front
HX711_ADC LoadCell_RF(HX711_dout_RF, HX711_sck_RF); //Right Front
HX711_ADC LoadCell_LR(HX711_dout_LR, HX711_sck_LR); //Left Rear
HX711_ADC LoadCell_RR(HX711_dout_RR, HX711_sck_RR); //Right Rear 

const int calVal_eepromAdress_LF = 0; // eeprom adress for calibration value load cell LF (4 bytes)
const int calVal_eepromAdress_RF = 4; // eeprom adress for calibration value load cell RF (4 bytes)
const int calVal_eepromAdress_LR = 8; // eeprom adress for calibration value load cell LR (4 bytes)
const int calVal_eepromAdress_RR = 12; // eeprom adress for calibration value load cell RR (4 bytes)
unsigned long t = 0;



void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);

delay(2000);
Serial.println();
Serial.println("Starting...");

float calibrationValue_LF; // calibration value load cell LF
float calibrationValue_RF; // calibration value load cell RF
float calibrationValue_LR; // calibration value load cell LR
float calibrationValue_RR; // calibration value load cell RR

calibrationValue_LF = 399.16; // uncomment this if you want to set this value in the sketch
calibrationValue_RF = 385.84; // uncomment this if you want to set this value in the sketch
calibrationValue_LR = 349.70; // uncomment this if you want to set this value in the sketch
calibrationValue_RR = 396.19; // uncomment this if you want to set this value in the sketch

#if defined(ESP8266) || defined(ESP32)
//EEPROM.begin(512); // uncomment this if you use ESP8266 and want to fetch the value from eeprom
#endif
//EEPROM.get(calVal_eepromAdress_LF, calibrationValue_LF); // uncomment this if you want to fetch the value from eeprom
//EEPROM.get(calVal_eepromAdress_RF, calibrationValue_RF); // uncomment this if you want to fetch the value from eeprom
//EEPROM.get(calVal_eepromAdress_LR, calibrationValue_LR); // uncomment this if you want to fetch the value from eeprom
//EEPROM.get(calVal_eepromAdress_RR, calibrationValue_RR); // uncomment this if you want to fetch the value from eeprom

LoadCell_LF.begin();
LoadCell_RF.begin();
LoadCell_LR.begin();
LoadCell_RR.begin();
unsigned long stabilizingtime = 5000; // tare preciscion can be improved by adding a few seconds of stabilizing time
boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
byte loadcell_LF_rdy = 0;
byte loadcell_RF_rdy = 0;
byte loadcell_LR_rdy = 0;
byte loadcell_RR_rdy = 0;
while ((loadcell_LF_rdy + loadcell_RF_rdy + loadcell_LR_rdy + loadcell_RR_rdy) < 2) { //run startup, stabilization and tare, both modules simultaniously
if (!loadcell_LF_rdy) loadcell_LF_rdy = LoadCell_LF.startMultiple(stabilizingtime, _tare);
if (!loadcell_RF_rdy) loadcell_RF_rdy = LoadCell_RF.startMultiple(stabilizingtime, _tare);
if (!loadcell_LR_rdy) loadcell_LR_rdy = LoadCell_LR.startMultiple(stabilizingtime, _tare);
if (!loadcell_RR_rdy) loadcell_RR_rdy = LoadCell_RR.startMultiple(stabilizingtime, _tare);
}
if (LoadCell_LF.getTareTimeoutFlag()) {
Serial.println("Timeout, check MCU>HX711 no.LF wiring and pin designations");
}
if (LoadCell_RF.getTareTimeoutFlag()) {
Serial.println("Timeout, check MCU>HX711 no.RF wiring and pin designations");
}
if (LoadCell_LR.getTareTimeoutFlag()) {
Serial.println("Timeout, check MCU>HX711 no.LR wiring and pin designations");
}
if (LoadCell_RR.getTareTimeoutFlag()) {
Serial.println("Timeout, check MCU>HX711 no.RR wiring and pin designations");
}
LoadCell_LF.setCalFactor(calibrationValue_LF); // user set calibration value (float)
LoadCell_RF.setCalFactor(calibrationValue_RF); // user set calibration value (float)
LoadCell_LR.setCalFactor(calibrationValue_LR); // user set calibration value (float)
LoadCell_RR.setCalFactor(calibrationValue_RR); // user set calibration value (float)
Serial.println("Startup is complete");
}

void loop() {

Blynk.run();
timer.run(); // Initiates BlynkTimer

Blynk.virtualWrite(V1, S1); 
Blynk.virtualWrite(V2, S2);
Blynk.virtualWrite(V3, S3);
Blynk.virtualWrite(V4, S4);
Blynk.virtualWrite(V5, S5);
Blynk.virtualWrite(V6, S6);
Blynk.virtualWrite(V7, S7);
Blynk.virtualWrite(V8, S8);
Blynk.virtualWrite(V9, S9);
Blynk.virtualWrite(V10, S10);
Blynk.virtualWrite(V11, S11);
Blynk.virtualWrite(V12, S12);
Blynk.virtualWrite(V13, S13);
Blynk.virtualWrite(V14, S14);
Blynk.virtualWrite(V15, S15);
Blynk.virtualWrite(V16, S16);
Blynk.virtualWrite(V17, S17);
Blynk.virtualWrite(V18, S18);
Blynk.virtualWrite(V19, S19);
Blynk.virtualWrite(V20, S20);
Blynk.virtualWrite(V21, S21);
Blynk.virtualWrite(V22, S22);
Blynk.virtualWrite(V23, S23);
Blynk.virtualWrite(V24, S24);
Blynk.virtualWrite(V25, S25);
Blynk.virtualWrite(V26, S26);
Blynk.virtualWrite(V27, S27);
Blynk.virtualWrite(V28, S28);
Blynk.virtualWrite(V29, S29);



static boolean newDataReady = 0;
const int serialPrintInterval = 2000; //increase value to slow down serial print activity

  // check for new data/start next conversion:
  if (LoadCell_LF.update()) newDataReady = true;
  LoadCell_RF.update();
  LoadCell_LR.update();
  LoadCell_RR.update();

  LoadCell_LF.update();
  if (LoadCell_RF.update()) newDataReady = true;
  LoadCell_LR.update();
  LoadCell_RR.update();

  LoadCell_LF.update();
  LoadCell_RF.update();
  if (LoadCell_LR.update()) newDataReady = true;
 LoadCell_RR.update();

  LoadCell_LF.update();
  LoadCell_RF.update();
  LoadCell_LR.update();
  if (LoadCell_RR.update()) newDataReady = true;

  //get smoothed value from data set
  if ((newDataReady)) {
    if (millis() > t + serialPrintInterval) {
  
  float LF = LoadCell_LF.getData(); // Left Front Tire Weight
  float RF = LoadCell_RF.getData(); // Right Front Tire Weight
  float LR = LoadCell_LR.getData(); // Left Rear Tire Weight
  float RR = LoadCell_RR.getData(); // Right Rear Tire Weight

  S1 = S2 + S3 + S4 + S5; // Total Weight
  S2 = LF / 1000; // Left Front Tire Weight
  S3 = RF / 1000; // Right Front Tire Weight
  S4 = LR / 1000; // Left Rear Tire Weight
  S5 = RR / 1000; // Right Rear Tire Weight
  S6 = S2 + S3; // Total Front Weight
  S7 = S6 / S1; // Total Front Rate
  S8 = S4 + S5; // Total Rear Weight
  S9 = S8 / S1; // Total Rear Rate
  S10 = S2 + S4; // Left Side Total Weight
  S11 = S10 / S1; // Left Side Total Rate
  S12 = S3 + S5; // Right Side Total Weight
  S13 = S12 / S1; // Right Side Total Rate     
  S14 = S3 + S4; // RF x LR Cross Weight (Wedge)   
  S15 = S14 / S1; // RF x LR Cross Rate
  S16 = S14 - S17; // RF x LR Pounds
  S17 = S2 + S5; // LF x RR Cross Weight 
  S18 = S17 / S1; // LF x RR Cross Rate
  S19 = S17 - S14; // LF x RR Pounds
  S20 = S10 * S6; // LF Target Tire Weight
  S21 = S20 - S2; // LF Weight Bias
  S22 = S12 * S6; // RF Target Tire Weight
  S23 = S22 - S3; // RF Weight Bias   
  S24 = S10 * S8; // LR Target Tire Weight
  S25 = S24 - S4; // LR Weight Bias     
  S26 = S12 * S8; // RR Target Tire Weight
  S27 = S26 - S5; // RR Weight Bias   
  S28 = S4 - S5; // Bite        
  S29 = S24 - S26; // Bite Target 

  

 
  newDataReady = 0;
  t = millis();
    }
 }

  // receive command from serial terminal, send 't' to initiate tare operation:
  if (Serial.available() > 0) {
   char inByte = Serial.read();
    if (inByte == 't') {
      LoadCell_LF.tareNoDelay();
      LoadCell_RF.tareNoDelay();
     LoadCell_LR.tareNoDelay();
     LoadCell_RR.tareNoDelay();
    }
  }

  //check if last tare operation is complete
if (LoadCell_LF.getTareStatus() == true) {
Serial.println("Tare load cell LF complete");
  }
if (LoadCell_RF.getTareStatus() == true) {
Serial.println("Tare load cell RF complete");
  }
if (LoadCell_LR.getTareStatus() == true) {
Serial.println("Tare load cell LR complete");
  }
if (LoadCell_RR.getTareStatus() == true) {
Serial.println("Tare load cell RR complete");
  }

  }

Arduino:1.8.16 (Windows 10), Kart:“NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200”

C:\Users\XPS\Documents\Arduino\Read_4x_load_cell_v6\Read_4x_load_cell_v6.ino: In function ‘void loop()’:

Read_4x_load_cell_v6:111:28: error: ‘S1’ was not declared in this scope; did you mean ‘SS’?

111 | Blynk.virtualWrite(V1, S1);

  |                            ^~

  |                            SS

Read_4x_load_cell_v6:112:28: error: ‘S2’ was not declared in this scope; did you mean ‘SS’?

112 | Blynk.virtualWrite(V2, S2);

  |                            ^~

  |                            SS

Read_4x_load_cell_v6:113:28: error: ‘S3’ was not declared in this scope; did you mean ‘SS’?

113 | Blynk.virtualWrite(V3, S3);

  |                            ^~

  |                            SS

Read_4x_load_cell_v6:114:28: error: ‘S4’ was not declared in this scope; did you mean ‘SS’?

114 | Blynk.virtualWrite(V4, S4);

  |                            ^~

  |                            SS

Read_4x_load_cell_v6:115:28: error: ‘S5’ was not declared in this scope; did you mean ‘SS’?

115 | Blynk.virtualWrite(V5, S5);

  |                            ^~

  |                            SS

Read_4x_load_cell_v6:116:28: error: ‘S6’ was not declared in this scope; did you mean ‘SS’?

116 | Blynk.virtualWrite(V6, S6);

  |                            ^~

  |                            SS

Read_4x_load_cell_v6:117:28: error: ‘S7’ was not declared in this scope; did you mean ‘SS’?

117 | Blynk.virtualWrite(V7, S7);

  |                            ^~

  |                            SS

Read_4x_load_cell_v6:118:28: error: ‘S8’ was not declared in this scope; did you mean ‘SS’?

118 | Blynk.virtualWrite(V8, S8);

  |                            ^~

  |                            SS

Read_4x_load_cell_v6:119:28: error: ‘S9’ was not declared in this scope; did you mean ‘SS’?

119 | Blynk.virtualWrite(V9, S9);

  |                            ^~

  |                            SS

Read_4x_load_cell_v6:120:29: error: ‘S10’ was not declared in this scope; did you mean ‘D10’?

120 | Blynk.virtualWrite(V10, S10);

  |                             ^~~

  |                             D10

Read_4x_load_cell_v6:121:29: error: ‘S11’ was not declared in this scope; did you mean ‘V11’?

121 | Blynk.virtualWrite(V11, S11);

  |                             ^~~

  |                             V11

Read_4x_load_cell_v6:122:29: error: ‘S12’ was not declared in this scope; did you mean ‘V12’?

122 | Blynk.virtualWrite(V12, S12);

  |                             ^~~

  |                             V12

Read_4x_load_cell_v6:123:29: error: ‘S13’ was not declared in this scope; did you mean ‘V13’?

123 | Blynk.virtualWrite(V13, S13);

  |                             ^~~

  |                             V13

Read_4x_load_cell_v6:124:29: error: ‘S14’ was not declared in this scope; did you mean ‘V14’?

124 | Blynk.virtualWrite(V14, S14);

  |                             ^~~

  |                             V14

Read_4x_load_cell_v6:125:29: error: ‘S15’ was not declared in this scope; did you mean ‘V15’?

125 | Blynk.virtualWrite(V15, S15);

  |                             ^~~

  |                             V15

Read_4x_load_cell_v6:126:29: error: ‘S16’ was not declared in this scope; did you mean ‘s16’?

126 | Blynk.virtualWrite(V16, S16);

  |                             ^~~

  |                             s16

Read_4x_load_cell_v6:127:29: error: ‘S17’ was not declared in this scope; did you mean ‘V17’?

127 | Blynk.virtualWrite(V17, S17);

  |                             ^~~

  |                             V17

Read_4x_load_cell_v6:128:29: error: ‘S18’ was not declared in this scope; did you mean ‘V18’?

128 | Blynk.virtualWrite(V18, S18);

  |                             ^~~

  |                             V18

Read_4x_load_cell_v6:129:29: error: ‘S19’ was not declared in this scope; did you mean ‘V19’?

129 | Blynk.virtualWrite(V19, S19);

  |                             ^~~

  |                             V19

Read_4x_load_cell_v6:130:29: error: ‘S20’ was not declared in this scope; did you mean ‘V20’?

130 | Blynk.virtualWrite(V20, S20);

  |                             ^~~

  |                             V20

Read_4x_load_cell_v6:131:29: error: ‘S21’ was not declared in this scope; did you mean ‘V21’?

131 | Blynk.virtualWrite(V21, S21);

  |                             ^~~

  |                             V21

Read_4x_load_cell_v6:132:29: error: ‘S22’ was not declared in this scope; did you mean ‘V22’?

132 | Blynk.virtualWrite(V22, S22);

  |                             ^~~

  |                             V22

Read_4x_load_cell_v6:133:29: error: ‘S23’ was not declared in this scope; did you mean ‘V23’?

133 | Blynk.virtualWrite(V23, S23);

  |                             ^~~

  |                             V23

Read_4x_load_cell_v6:134:29: error: ‘S24’ was not declared in this scope; did you mean ‘V24’?

134 | Blynk.virtualWrite(V24, S24);

  |                             ^~~

  |                             V24

Read_4x_load_cell_v6:135:29: error: ‘S25’ was not declared in this scope; did you mean ‘V25’?

135 | Blynk.virtualWrite(V25, S25);

  |                             ^~~

  |                             V25

Read_4x_load_cell_v6:136:29: error: ‘S26’ was not declared in this scope; did you mean ‘V26’?

136 | Blynk.virtualWrite(V26, S26);

  |                             ^~~

  |                             V26

Read_4x_load_cell_v6:137:29: error: ‘S27’ was not declared in this scope; did you mean ‘V27’?

137 | Blynk.virtualWrite(V27, S27);

  |                             ^~~

  |                             V27

Read_4x_load_cell_v6:138:29: error: ‘S28’ was not declared in this scope; did you mean ‘V28’?

138 | Blynk.virtualWrite(V28, S28);

  |                             ^~~

  |                             V28

Read_4x_load_cell_v6:139:29: error: ‘S29’ was not declared in this scope; did you mean ‘V29’?

139 | Blynk.virtualWrite(V29, S29);

  |                             ^~~

  |                             V29

exit status 1

‘S1’ was not declared in this scope; did you mean ‘SS’?

can you help me with this?

Hey there,
First of all you must read this
https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean

2 Likes

I see that you have not defined a bunch of variables.

also as john93 has said you need to remove all the extra code from the void loop. If that does not help then I suggest that you get a primer on c programming.

1 Like

I’m looking into this issue. Thank you for your referral.

1 Like

Actually I get 4 data from sensors. As far as I know, mathematical operations cannot be performed in Blynk. So I have multiple (30) variables.

Can you explain please ?

I am reading LF (Left Front Tire Weight), RF (Right Front Tire Weight), LR (Left RearTire Weight) and RR (Right Rear Tire Weight) data from the sensor. For the total weight, I collect this data in Nodemcu and send it to the virtual pin. Total=LF+RF+LR+RR. I hope I’m not doing anything wrong here. Can we send only 4 data to blynk application and perform mathematical operations on the application? I get 30 different values from these 4 data using mathematical operations.

No, you need to do those calculations within your sketch and send your results to Blynk.

Your compiler messages are because you haven’t declared all of the internal variables that you are using in your calculations, as @Gyromike pointed out.

When you do this type of thing…

the compiler doesn’t understand what you mean by “S2” because you haven’t declared a variable called S2 and told the compiler whether to treat this as an Integer, Float, String, Character or Boolean variable.

You do declare the LF, RF LR and RR variables and tell the compiler that these are Float type variables…

and in many ways this makkes the S2 to S5 variables redundant, or raises the question why you don’t simply refer to LF to RR as S2 to S5 in the first place.

Also, you will start to run into problems with Variable Scope.
When you declare a variable within a function, like this:

That variable is only visible within that function, and is Local to that function.

If you declare those variables at the top of your code (outside of any void functions), they become Global variables and are visible throughout the scope of your code.

Also, think about what you’re doing here…

Your first line of code sums-up the values that are assigned to St to S5, but at the point when you do that, the values of S2 to S5 are currently empty (zero), because the lines of code that transfer data into S2 to S5 haven’t yet been executed.

The correct way to do this would be:

      S2 = LF / 1000; // Left Front Tire Weight
      S3 = RF / 1000; // Right Front Tire Weight
      S4 = LR / 1000; // Left Rear Tire Weight
      S5 = RR / 1000; // Right Rear Tire Weight
      S1 = S2 + S3 + S4 + S5; // Total Weight

It also makes much more sense to use meaningful variable names, such as total_weight rather than S1, as it will make your code much easier to follow and debug in future.

However, the most important issue as far as Blynk is concerned is the state of your void loop, as @John93 pointed-out.
If you leave your void loop like this then you will get constant disconnections from Blynk once you resolve all of your other issues.

So, as you re-write your code to overcome your variable declaration, variable scope, variable naming conventions and logic issues, you should also change the structure of the code to move the “take a set of readings and do the calculations” process into a function that is called with a BlynkTimer.

BTW, that’s either a very big breadboard or a very small car :grinning:

Pete.

2 Likes

I realize that I’m making things too complicated because I’m a bit of a novice.
I edited my codes on John93 suggestion and the system worked properly. I decided to go step by step. that’s why I transferred the values I read from the sensor to the blynk application without doing any mathematical operations. I am sharing my codes below


#define BLYNK_TEMPLATE_ID           "XXX"
#define BLYNK_DEVICE_NAME           "XXX"
#define BLYNK_AUTH_TOKEN            "XXX"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "XXX";
char pass[] = "XXX";
BlynkTimer timer; // Announcing the timer

#include <HX711_ADC.h>
#if defined(ESP8266)|| defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif


//pins:
const int HX711_dout_LF = 12; //mcu > LF dout pin
const int HX711_sck_LF = 14; //mcu > LF sck pin
const int HX711_dout_RF = 4; //mcu > RF dout pin
const int HX711_sck_RF = 0; //mcu > RF sck pin
const int HX711_dout_LR = 13; //mcu > LR dout pin
const int HX711_sck_LR = 15; //mcu > LR sck pin
const int HX711_dout_RR = 5; //mcu > RR dout pin
const int HX711_sck_RR = 16; //mcu > RR sck pin

//HX711 constructor (dout pin, sck pin)
HX711_ADC LoadCell_LF(HX711_dout_LF, HX711_sck_LF); //Left Front
HX711_ADC LoadCell_RF(HX711_dout_RF, HX711_sck_RF); //Right Front
HX711_ADC LoadCell_LR(HX711_dout_LR, HX711_sck_LR); //Left Rear
HX711_ADC LoadCell_RR(HX711_dout_RR, HX711_sck_RR); //Right Rear 

const int calVal_eepromAdress_LF = 0; // eeprom adress for calibration value load cell LF (4 bytes)
const int calVal_eepromAdress_RF = 4; // eeprom adress for calibration value load cell RF (4 bytes)
const int calVal_eepromAdress_LR = 8; // eeprom adress for calibration value load cell LR (4 bytes)
const int calVal_eepromAdress_RR = 12; // eeprom adress for calibration value load cell RR (4 bytes)
unsigned long t = 0;



void setup() {
  
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(100L, sensorDataSend); //timer will run every sec
    
  delay(2000);
  Serial.println();
  Serial.println("Starting...");

  float calibrationValue_LF; // calibration value load cell LF
  float calibrationValue_RF; // calibration value load cell RF
  float calibrationValue_LR; // calibration value load cell LR
  float calibrationValue_RR; // calibration value load cell RR

  calibrationValue_LF = 399.16; // uncomment this if you want to set this value in the sketch
  calibrationValue_RF = 385.84; // uncomment this if you want to set this value in the sketch
  calibrationValue_LR = 349.70; // uncomment this if you want to set this value in the sketch
  calibrationValue_RR = 396.19; // uncomment this if you want to set this value in the sketch

  #if defined(ESP8266) || defined(ESP32)
  //EEPROM.begin(512); // uncomment this if you use ESP8266 and want to fetch the value from eeprom
#endif
  //EEPROM.get(calVal_eepromAdress_LF, calibrationValue_LF); // uncomment this if you want to fetch the value from eeprom
  //EEPROM.get(calVal_eepromAdress_RF, calibrationValue_RF); // uncomment this if you want to fetch the value from eeprom
  //EEPROM.get(calVal_eepromAdress_LR, calibrationValue_LR); // uncomment this if you want to fetch the value from eeprom
  //EEPROM.get(calVal_eepromAdress_RR, calibrationValue_RR); // uncomment this if you want to fetch the value from eeprom

  LoadCell_LF.begin();
  LoadCell_RF.begin();
  LoadCell_LR.begin();
  LoadCell_RR.begin();
  unsigned long stabilizingtime = 5000; // tare preciscion can be improved by adding a few seconds of stabilizing time
  boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
  byte loadcell_LF_rdy = 0;
  byte loadcell_RF_rdy = 0;
  byte loadcell_LR_rdy = 0;
  byte loadcell_RR_rdy = 0;
  while ((loadcell_LF_rdy + loadcell_RF_rdy + loadcell_LR_rdy + loadcell_RR_rdy) < 2) { //run startup, stabilization and tare, both modules simultaniously
    if (!loadcell_LF_rdy) loadcell_LF_rdy = LoadCell_LF.startMultiple(stabilizingtime, _tare);
    if (!loadcell_RF_rdy) loadcell_RF_rdy = LoadCell_RF.startMultiple(stabilizingtime, _tare);
    if (!loadcell_LR_rdy) loadcell_LR_rdy = LoadCell_LR.startMultiple(stabilizingtime, _tare);
    if (!loadcell_RR_rdy) loadcell_RR_rdy = LoadCell_RR.startMultiple(stabilizingtime, _tare);
  }
  if (LoadCell_LF.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 no.LF wiring and pin designations");
  }
   if (LoadCell_RF.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 no.RF wiring and pin designations");
  }
   if (LoadCell_LR.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 no.LR wiring and pin designations");
  }
  if (LoadCell_RR.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 no.RR wiring and pin designations");
  }
  LoadCell_LF.setCalFactor(calibrationValue_LF); // user set calibration value (float)
  LoadCell_RF.setCalFactor(calibrationValue_RF); // user set calibration value (float)
  LoadCell_LR.setCalFactor(calibrationValue_LR); // user set calibration value (float)
  LoadCell_RR.setCalFactor(calibrationValue_RR); // user set calibration value (float)
  Serial.println("Startup is complete");
}

void sensorDataSend() {
  
  static boolean newDataReady = 0;
  const int serialPrintInterval = 2000; //increase value to slow down serial print activity

  // check for new data/start next conversion:
  if (LoadCell_LF.update()) newDataReady = true;
  LoadCell_RF.update();
  LoadCell_LR.update();
  LoadCell_RR.update();

  LoadCell_LF.update();
  if (LoadCell_RF.update()) newDataReady = true;
  LoadCell_LR.update();
  LoadCell_RR.update();

  LoadCell_LF.update();
  LoadCell_RF.update();
  if (LoadCell_LR.update()) newDataReady = true;
  LoadCell_RR.update();

  LoadCell_LF.update();
  LoadCell_RF.update();
  LoadCell_LR.update();
  if (LoadCell_RR.update()) newDataReady = true;

  //get smoothed value from data set
  if ((newDataReady)) {
    if (millis() > t + serialPrintInterval) {
      
      float LF = LoadCell_LF.getData()/1000; // Left Front Tire Weight
      float RF = LoadCell_RF.getData()/1000; // Right Front Tire Weight
      float LR = LoadCell_LR.getData()/1000; // Left Rear Tire Weight
      float RR = LoadCell_RR.getData()/1000; // Right Rear Tire Weight

      Serial.println("...");
      Serial.print("Left Front Tire Weight: ");
      Serial.print(LF);
      Serial.println("kg");
      Serial.print("Right Front Tire Weight: ");
      Serial.print(RF); 
      Serial.println("kg");
      Serial.print("Left Rear Tire Weight: ");
      Serial.print(LR);
      Serial.println("kg");
      Serial.print("Right Rear Tire Weight: ");
      Serial.print(RR);
      Serial.println("kg");


      Blynk.virtualWrite(V2, LF);  // sending LF to Blynk app
      Blynk.virtualWrite(V3, RF);  // sending RF to Blynk app
      Blynk.virtualWrite(V4, LR);  // sending LR to Blynk app
      Blynk.virtualWrite(V5, RR);  // sending RR to Blynk app

      newDataReady = 0;
      t = millis();
    }
  }

  // receive command from serial terminal, send 't' to initiate tare operation:
  if (Serial.available() > 0) {
    char inByte = Serial.read();
    if (inByte == 't') {
      LoadCell_LF.tareNoDelay();
      LoadCell_RF.tareNoDelay();
      LoadCell_LR.tareNoDelay();
      LoadCell_RR.tareNoDelay();
    }
  }

  //check if last tare operation is complete
  if (LoadCell_LF.getTareStatus() == true) {
    Serial.println("Tare load cell LF complete");
  }
   if (LoadCell_RF.getTareStatus() == true) {
    Serial.println("Tare load cell RF complete");
  }
   if (LoadCell_LR.getTareStatus() == true) {
    Serial.println("Tare load cell LR complete");
  }
  if (LoadCell_RR.getTareStatus() == true) {
    Serial.println("Tare load cell RR complete");
  }

}

void loop()
{
  Blynk.run();        // run Blynk magic
  timer.run();        // run timer every second
}

I’ll take into account what PeteKnight said about mathematical operations.

There are a few points that I don’t understand in my code above.

timer.setInterval(100L, sensorDataSend);

I made the value here 100L. When it is 1000L, data transfer is very late. Would it help if I lower this number even more? does the system work like this?

I opened a void as void sensorDataSend() and took 4 float data into it and sent it to the application.


      float LF = LoadCell_LF.getData()/1000; // Left Front Tire Weight
      float RF = LoadCell_RF.getData()/1000; // Right Front Tire Weight
      float LR = LoadCell_LR.getData()/1000; // Left Rear Tire Weight
      float RR = LoadCell_RR.getData()/1000; // Right Rear Tire Weight

     
      Blynk.virtualWrite(V2, LF);  // sending LF to Blynk app
      Blynk.virtualWrite(V3, RF);  // sending RF to Blynk app
      Blynk.virtualWrite(V4, LR);  // sending LR to Blynk app
      Blynk.virtualWrite(V5, RR);  // sending RR to Blynk app 

Do I need to open a void for each float here? does the system work like this? Can I use a float I created in one void in another void? As a result, I need to mathematically associate the 4 main floats with each other.

I’m setting up a small demo of the system, then I’ll make a 1/1 scale version. Actually there is a big car. if for now it’s called a car :slight_smile:

You can view articles about our work at the link below.

1 Like

This value is milliseconds, 1000L is 1 second.

My advice (although you’ve ignored my previous advice, so I’m not sure you’ll take any notice of this either) would be to remove all of the millis() stuff from your sensorDataSend function, and rely on the BlynkTimer to control all of your timings. Your millis() operations are distorting the speed of operation at the moment.

You can’t (and shouldn’t need to) increase your timer frequency (make the value any less than 1000L) as this will cause issues with too many Blynk.virtualWrite operations per second.

Also, the process of using an input from your serial monitor to trigger the tare process shouldn’t be in your sensorDataSend function, and is something that should be an independent function triggered via a button widget in the app…

In fact, I’d probably split your existing sensorDataSend function up into more modular sections, and call them as needed.

I have no idea what you’re asking with the “Do I need to open a void for each float here?” part of the question, but I’ve already explained about how you can use the same variables across multiple functions by making those variables global (but you’ve not done that).

Maybe you should study some online C++ programming videos on YouTube to increase your knowledge, because the questions that you are asking are not Blynk related.

Pete.

I looked at your blog it was interesting.

I think you have some misconceptions

Void is a data type nothing special. It is like int or float or double.

It would be good for you to look at some c programing tutorials before getting much further.

The type declaration before a function tells the compiler what will be returned by the function. If it is void then nothing is returned.

2 Likes