Friend, have you solved the problem of disconnecting?
My problem does not give any error in the serial but disconnects from the Blynk server and does not connect anymore only after a reset.
Can someone help me?
Can you post a sketch and confirm your connection method matches what is indicated by the sketch?
define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include "HX711.h"
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] =“#########"";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*********";
char pass[] = "********";
BlynkTimer timer;
#define DOUT D3
#define CLK D5
HX711 balanca(DOUT, CLK);
float calibration_factor = 23650;
void setup()
{{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
delay(3000) ;
Serial.println("Balança com HX711 - celula de carga 50 Kg");
Serial.println("Pressione t para Tara");
balanca.set_scale(calibration_factor);
balanca.tare();
}
void loop()
{
Serial.print("Peso: ");
Serial.print(balanca.get_units(), 3);
Serial.println(" kg");
Blynk.virtualWrite(V5, balanca.get_units(), 3);
delay(3000) ;
if (Serial.available())
{
char temp = Serial.read();
if (temp == 't' || temp == 'T')
{
balanca.tare();
Serial.println("Balançazerada");
Blynk.run();
timer.run();
}
}
}
Just Blynk and timer run in loop().
Just put that line of code in the Void Loop ?
BlynkTimer timer;
???
No, the two x.run commands you already have and remove all the other stuff.
Friend you could be clearer, because I am using translator I am Brazilian and do not have much intimacy with programming.
I sending the skecth around here could you make the change and have it corrected?
Your code seems a bit odd anyway, regardless of the cluttered void loop.
Why are you watching the serial UART for incoming character before taking a weight reading? A much more sensible approach would be to add a Blynk switch widget and use that to trigger a weight reading, or add a Blynk timer to take a reading every x seconds.
As far as cleaning-up your void loop is concerned, you should read this:
Pete.
Make it look like this
void loop() {
Blynk.run();
timer.run();
}
I’ll modify and see what’s going to happen