Unwanted delay in slider reaction

I have the same problem too. when I move the slider of the V12 pin, the pin V4 value changes after a long time. This Is my sketch:

    #define BLYNK_PRINT Serial


#include <SPI.h>
#include <Fishino.h>
#include <BlynkSimpleFishino.h>
#include <OneWire.h>
#include <DallasTemperature.h>

char auth[] = "xxxxxx";
char ssid[] = "xxxx";
char pass[] = "xxxxx";
int TCSET = 8;



#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress tmp_address;
int numberOfDevices;
float TC[20];

WidgetLED ledC1(V8);
WidgetLED ledC2(V9);
WidgetLED ledC3(V10);
WidgetLED ledC4(V11);

BlynkTimer timer;

void inviaTemp() {
  
  Blynk.virtualWrite (V0, (TC[0]));

}

void inviaInfo() {

  if (TC[0] > TCSET)
  {
    Blynk.setProperty(V8, "color", "#D3435C");
  }
  else
  {
    Blynk.setProperty(V8, "color", "#00CC99");
  }
}


void setup()
{

  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass, IPAddress(xxx,xxx,xxx,xxx));

  timer.setInterval(300000L, inviaTemp);
  timer.setInterval(1000L, inviaInfo);

  Blynk.syncVirtual(V12);

  Serial.println("Sto cercando i sensori...");
  sensors.begin();
  //delay(6000);
  numberOfDevices = sensors.getDeviceCount();
  Serial.print("Trovati ");
  Serial.print(numberOfDevices);
  Serial.print(" sensori ");
  Serial.println("Inizio la misurazione...");
  Serial.println();

  ledC1.on();
  ledC2.on();
  ledC3.on();
  ledC4.on();
}

void loop()
{
  Blynk.run();
  timer.run();

  sensors.requestTemperatures(); // Comando per misurare la temp.
  for (int i = 0; i < numberOfDevices; i++)
  {
    TC[i] = sensors.getTempCByIndex(i);
    Serial.print("Sensore ");
    Serial.print(i);
    Serial.print(": ");
    Serial.print(sensors.getTempCByIndex(i));
    Serial.print(" gradi C");
    Serial.print(TCSET);
    Serial.println();
  }
}

BLYNK_WRITE(V12)
{
  TCSET = param.asInt();
  Blynk.virtualWrite (V4, TCSET);
}

Can you tell me where I’m wrong?

Thank you

I moved your issue to your own topic. Please don’t post new issues in very old and solved topics. Thanks.

As for the issue, try to keep the main void loop() clear of any running code, aside from Blynk.run() and timer.run().

Instead create another timer call with and scan your sensors every few seconds instead of multiple times a second. This should help.

1 Like

Excuse me, I’ve searched the forum, but I only found the ticket in question. I solved for changing sketch:

#define BLYNK_PRINT Serial


#include <SPI.h>
#include <Fishino.h>
#include <BlynkSimpleFishino.h>
#include <OneWire.h>
#include <DallasTemperature.h>

char auth[] = "7aa80b2f79034955a62fd31341470020";
char ssid[] = "CasaBonch";
char pass[] = "123stella";
int TCSET = 8;
int allarmeC1 = 0;



#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress tmp_address;
int numberOfDevices;
float TC[20];

WidgetLED ledC1(V8);
WidgetLED ledC2(V9);
WidgetLED ledC3(V10);
WidgetLED ledC4(V11);

BlynkTimer timer;

void inviaTemp() {

  Blynk.virtualWrite (V0, (TC[0]));

}

void lettura() {

  sensors.requestTemperatures(); // Comando per misurare la temp.
  for (int i = 0; i < numberOfDevices; i++)
  {
    TC[i] = sensors.getTempCByIndex(i);
    Serial.print("Sensore ");
    Serial.print(i);
    Serial.print(": ");
    Serial.print(sensors.getTempCByIndex(i));
    Serial.print(" gradi C");
    Serial.print(TCSET);
    Serial.print(" allarmeC1:");
    Serial.print(allarmeC1);
    Serial.println();
  }


}

void inviaInfo() {

  if (TC[0] > TCSET) {

    if ((allarmeC1 == 0) && (TC[0] > TCSET)) {

      Blynk.notify("ALLARME TEMPERATURA CELLA 1");
    }

    Blynk.setProperty(V8, "color", "#D3435C");
    allarmeC1 = 1;
  }
  else
  {
    Blynk.setProperty(V8, "color", "#00CC99");
    allarmeC1 = 0;
  }
}


void setup()
{

  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass, IPAddress(2, 231, 138, 159));

  timer.setInterval(300000L, inviaTemp);
  timer.setInterval(1000L, inviaInfo);
  timer.setInterval(10000L, lettura);

  Blynk.syncVirtual(V12);

  Serial.println("Sto cercando i sensori...");
  sensors.begin();
  numberOfDevices = sensors.getDeviceCount();
  Serial.print("Trovati ");
  Serial.print(numberOfDevices);
  Serial.print(" sensori ");
  Serial.println("Inizio la misurazione...");
  Serial.println();

  ledC1.on();
  ledC2.on();
  ledC3.on();
  ledC4.on();
}

void loop()
{
  Blynk.run();
  timer.run();
}

BLYNK_WRITE(V12)
{
  TCSET = param.asInt();
  Blynk.virtualWrite (V4, TCSET);
}

Thanks again for your availability and for the disorder

1 Like