Beehive scale connect blynk

hello, If you can help me… I am basic English. How connect blynk? but cannot connect. What’s wrong code?
Thank you
here copy code:

#define BLYNK_PRINT Serial

#include <Arduino.h>
#include "HX711.h"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <EEPROM.h>
#include "src/settings.cpp"

const char wifiSSID[] = "******";
const char wifiPassword[] = "******";
const char blynkAuth[] = "*********************************"; // for each weight


// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = D1;
const int LOADCELL_SCK_PIN = D2;

// about 5 minutes 293e6
// about 20 minutes 1193e6
// const double DEEP_SLEEP_TIME = 293e6;

// Deep sleep interval in seconds
int deep_sleep_interval = 285;

Settings settings;
WiFiClient client;
HX711 scale;

// Attach Blynk virtual serial terminal
WidgetTerminal terminal(V3);


// deep sleep interval in seconds
BLYNK_WRITE(V8)
{
  if (param.asInt())
  {
    deep_sleep_interval = param.asInt();
    Serial.println("Deep sleep interval was set to: " + String(deep_sleep_interval));
    Blynk.virtualWrite(V7, String(deep_sleep_interval));
  }
}

// Synchronize settings from Blynk server with device when internet is connected
BLYNK_CONNECTED()
{
  Blynk.syncAll();
}

// device is enabled
bool isEnabled = true;

// Turn on/off
BLYNK_WRITE(V0)
{
  isEnabled = param.asInt();
}

// Terminal input
BLYNK_WRITE(V3)
{
  String valueFromTerminal = param.asStr();

  if (String("clear") == valueFromTerminal)
  {
    terminal.clear();
    terminal.println("CLEARED");
    terminal.flush();
  }
  if (String("restart") == valueFromTerminal || String("reset") == valueFromTerminal)
  {
    terminal.clear();
    terminal.println("RESTART");
    terminal.flush();
    delay(500);
    ESP.restart();
  }
  else if (valueFromTerminal != "\n" || valueFromTerminal != "\r" || valueFromTerminal != "")
  {
    terminal.println(String("unknown command: ") + valueFromTerminal);
    terminal.flush();
  }
}

void setup()
{
  Serial.begin(115200);
  Serial.println("Initializing the scale");

  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  delay(300);
  scale.power_up();

  delay(1000);
  EEPROM.begin(512);

  bool secondChange = false;

  if (!scale.is_ready())
  {
    secondChange = true;
    scale.power_down();
    delay(1000);
    scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
    delay(300);
    scale.power_up();
    delay(1000);
  }

  if (scale.is_ready())
  {
    // Sencor SBS 113L
    scale.set_scale(settings.scale);

    // formula A. B. C
    // float average = scale.get_units(10);
    // if (average < 0)
    // {
    //   average = average * -1;
    // }

    // float value = average + settings.offset;

    // formula E, F
    float value = scale.get_units(10) + settings.offset;
    if (value < 0)
    {
      value = value * -1;
    }

    Serial.println("average:\t" + String(value) + " kg");

    int connAttempts = 0;
    Serial.println("\r\nTry connecting to: " + String(wifiSSID));

    WiFi.begin(wifiSSID, wifiPassword);

    while (WiFi.status() != WL_CONNECTED)
    {
      delay(500);
      Serial.print(".");
      if (connAttempts > 30)
      {
        Serial.println("Error - couldn't connect to WIFI");
        break;
      }

      connAttempts++;
    }

    Blynk.config(blynkAuth, "*******.my****cloud.com", 17080);
    Blynk.connect(2000);

    if (Blynk.connected())
    {
      Serial.println("WiFI connected OK");
    }
    else
    {
      Serial.println("No WIFI !");
    }

    // wait for blynk sync
    delay(1000);

    Blynk.virtualWrite(V2, WiFi.RSSI());
    Blynk.virtualWrite(V5, isEnabled ? (secondChange ? "OK 2 pokusy" : "OK") : "Váha je vypnuta.");

    if (isEnabled)
    {
      Serial.println("ENABLED");
      Blynk.virtualWrite(V1, value);

      float previousValue = 0.00f;
      EEPROM.get(0, previousValue);
      EEPROM.put(0, value);
      EEPROM.commit();

      float difference = value - previousValue;
      Blynk.virtualWrite(V6, difference);
    } else {
      Serial.println("DISABLED");
    }

    if (Blynk.connected())
    {
      Serial.println("Sent OK");
    }
  }
  else
  {
    Serial.println("HX711 doesn't work");
    Blynk.begin(blynkAuth, wifiSSID, wifiPassword, "*******.my****cloud.com", 17080);

    Serial.println("Connect blynk");

    int rssi = WiFi.RSSI();
    Blynk.virtualWrite(V2, rssi);

    if (secondChange)
    {
      Blynk.virtualWrite(V5, "HX711 nefunguje. 2. pokus");
    }
    else
    {
      Blynk.virtualWrite(V5, "HX711 nefunguje.");
    }

    Serial.println("Blynk send");
  }

  scale.power_down();
  delay(300);

  if (WiFi.isConnected())
  {
    Blynk.disconnect();
    WiFi.disconnect(true);

    Serial.println("Disconnected OK");
  }
  else
  {
    Serial.println("Already disconnected");
  }

  EEPROM.end();

  Serial.println("Go to sleep for " + String(deep_sleep_interval) + " seconds.");
  ESP.deepSleep(deep_sleep_interval * 1000000);
}

void loop()
{
}

other: "src/settings.cpp"  copy here:

// Project settings
struct Settings
{
    const double scale = 22500.0; // for each weight
    const double offset = 0.9; // for each weight
};

I am copy code from website: GitHub - vitzaoral/beehive_weight: Bee hive weight monitoring

here serial monitor: no connect no wifi..

   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.0 on ESP8266

[7559] Connecting to nas012975.myqnapcloud.com:17080
No WIFI !
ENABLED
[11187] Disconnected
Disconnected OK
Go to sleep for 285 seconds.

@Damjan_Slapnik Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.

I’m sorry, I don’t know what to add… please help us

You need to add triple backticks at the beginning and end of your code, otherwise your unformatted code will be deleted.

Pete.

I hope that okay.

Here’s what you need to do…

  1. upgrade your Blynk library from 1.0.0 to the latest version (1.3.2)

  2. copy/paste the three lines of firmware configuration code from your Blynk web console > Device > Developer Tools > General tab to the very top of your sketch.

  3. delete this line of code…

  1. change this line of code…

to this…

Blynk.config(BLYNK_AUTH_TOKEN);

Pete.

too no work… I don’t understand…
how?

{$l��|�d�|  � l� #|���e�s�b� c��'o�$gn���cp��ds$sdp�g��l�� c n�|� ��c��g'�l��d`�egn d`ags�ۓo #l�dp�g� sĜ����co�< �c��'o� d`�ee'o d`gs���o b��`r��g c��`� ��x� $`��g�d���e�'�{��o<�l � d`c� �|s�d�g� �'� d`��r�l�d� �Initializing the scale

average: 2.37 kg

Try connecting to: domaca

.......[6430]

___ __ __

/ _ )/ /_ _____ / /__

/ _ / / // / _ \/ '_/

/____/_/\_, /_//_/_/\_\

/___/ v1.3.2 on ESP8266

#StandWithUkraine https://bit.ly/swua

[6436] Connecting to blynk.cloud:80

No WIFI !

ENABLED

[10063] Disconnected

Disconnected OK

Go to sleep for 285 seconds.

Ln 39, Col 12

LOLIN(WEMOS) D1 R2 & mini

on COM7

2

Serial output is meaningless without your updated code.

Pete.

i dont understand what it?

Post your latest code

Pete.

again repair code. also no wifi

#define BLYNK_PRINT Serial
#define BLYNK_AUTH_TOKEN "hidden" // for each weight


#include <Arduino.h>
#include "HX711.h"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <EEPROM.h>
#include "src/settings.cpp"

char SSID[] = "hidden";
char Password[] = "hidden";



// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = D1;
const int LOADCELL_SCK_PIN = D2;

// Deep sleep interval in seconds
int deep_sleep_interval = 285;

Settings settings;
WiFiClient client;
HX711 scale;

// Attach Blynk virtual serial terminal
WidgetTerminal terminal(V3);


// deep sleep interval in seconds
BLYNK_WRITE(V8)
{
  if (param.asInt())
  {
    deep_sleep_interval = param.asInt();
    Serial.println("Deep sleep interval was set to: " + String(deep_sleep_interval));
    Blynk.virtualWrite(V7, String(deep_sleep_interval));
  }
}

// Synchronize settings from Blynk server with device when internet is connected
BLYNK_CONNECTED()
{
  Blynk.syncAll();
}

// device is enabled
bool isEnabled = true;

// Turn on/off
BLYNK_WRITE(V0)
{
  isEnabled = param.asInt();
}

// Terminal input
BLYNK_WRITE(V3)
{
  String valueFromTerminal = param.asStr();

  if (String("clear") == valueFromTerminal)
  {
    terminal.clear();
    terminal.println("CLEARED");
    terminal.flush();
  }
  if (String("restart") == valueFromTerminal || String("reset") == valueFromTerminal)
  {
    terminal.clear();
    terminal.println("RESTART");
    terminal.flush();
    delay(500);
    ESP.restart();
  }
  else if (valueFromTerminal != "\n" || valueFromTerminal != "\r" || valueFromTerminal != "")
  {
    terminal.println(String("unknown command: ") + valueFromTerminal);
    terminal.flush();
  }
}

void setup()
{
  Serial.begin(115200);
  Serial.println("Initializing the scale");

  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  delay(300);
  scale.power_up();

  delay(1000);
  EEPROM.begin(512);

  bool secondChange = false;

  if (!scale.is_ready())
  {
    secondChange = true;
    scale.power_down();
    delay(1000);
    scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
    delay(300);
    scale.power_up();
    delay(1000);
  }

  if (scale.is_ready())
  {
    // Sencor SBS 113L
    scale.set_scale(settings.scale);

    // formula A. B. C
    // float average = scale.get_units(10);
    // if (average < 0)
    // {
    //   average = average * -1;
    // }

    // float value = average + settings.offset;

    // formula E, F
    float value = scale.get_units(10) + settings.offset;
    if (value < 0)
    {
      value = value * -1;
    }

    Serial.println("average:\t" + String(value) + " kg");

    int connAttempts = 0;
    Serial.println("\r\nTry connecting to: " + String(SSID));

    WiFi.begin(SSID, Password);

    while (WiFi.status() != WL_CONNECTED)
    {
      delay(500);
      Serial.print(".");
      if (connAttempts > 30)
      {
        Serial.println("Error - couldn't connect to WIFI");
        break;
      }

      connAttempts++;
    }

    Blynk.config(BLYNK_AUTH_TOKEN, "*******.my****cloud.com", 17080); //my home server for blynk 1.0 
    Blynk.connect(2000);

    if (Blynk.connected())
    {
      Serial.println("WiFI connected OK");
    }
    else
    {
      Serial.println("No WIFI !");
    }

    // wait for blynk sync
    delay(1000);

    Blynk.virtualWrite(V2, WiFi.RSSI());
    Blynk.virtualWrite(V5, isEnabled ? (secondChange ? "OK 2 pokusy" : "OK") : "Váha je vypnuta.");

    if (isEnabled)
    {
      Serial.println("ENABLED");
      Blynk.virtualWrite(V1, value);

      float previousValue = 0.00f;
      EEPROM.get(0, previousValue);
      EEPROM.put(0, value);
      EEPROM.commit();

      float difference = value - previousValue;
      Blynk.virtualWrite(V6, difference);
    } else {
      Serial.println("DISABLED");
    }

    if (Blynk.connected())
    {
      Serial.println("Sent OK");
    }
  }
  else
  {
    Serial.println("HX711 doesn't work");
    Blynk.begin(BLYNK_AUTH_TOKEN, SSID, Password, "*******.my****cloud.com", 17080); //my home server for blynk 1.0 

    Serial.println("Connect blynk");

    int rssi = WiFi.RSSI();
    Blynk.virtualWrite(V2, rssi);

    if (secondChange)
    {
      Blynk.virtualWrite(V5, "HX711 nefunguje. 2. pokus");
    }
    else
    {
      Blynk.virtualWrite(V5, "HX711 nefunguje.");
    }

    Serial.println("Blynk send");
  }

  scale.power_down();
  delay(300);

  if (WiFi.isConnected())
  {
    Blynk.disconnect();
    WiFi.disconnect(true);

    Serial.println("Disconnected OK");
  }
  else
  {
    Serial.println("Already disconnected");
  }

  EEPROM.end();

  Serial.println("Go to sleep for " + String(deep_sleep_interval) + " seconds.");
  ESP.deepSleep(deep_sleep_interval * 1000000);
}

void loop()
{
}
Initializing the scale
average:	0.90 kg

Try connecting to: domaca
.......[5722] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.3.2 on ESP8266

[5724] Connecting to "*******.my****cloud.com", 17080
No WIFI !
ENABLED
[9366] Disconnected
Disconnected OK
Go to sleep for 285 seconds.