BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Time imput widget

Hi,
I have a problem with the time input widget and I don’t know where to start., I’m sure it’s my problem because I didn’t quite understand how it works.
I have 7 time input widgets and 7 numeric inputs to control the time interval on Mondays to Fridays 4 widgets and 3 widgets to control on weekends, as in the attached images

My problem is that if I have a time interval from Monday to Friday and I have the same interval in the weekend, it returns the data from the last widget, don’t take into account that it is a weekend.
I certainly didn’t quite understand how this widget works and that’s why I need help.



#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#define DHTPIN 12          // What digital pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11     // DHT 11
#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxx";
char ssid[] = "xxxxxxxxxxxx";
char pass[] = "xxxxxxxxx";


float t_101=0.00;
float t_103=0.00;
float t_105=0.00;
float t_107=0.00;
float t_109=0.00;
float t_111=0.00;
float t_127=0.00;
int ora_start;
const int rel_centr = 2;


BLYNK_WRITE(V101){
  t_101=param.asInt();
}
BLYNK_WRITE(V103){
  t_103=param.asInt();
}
BLYNK_WRITE(V105){
  t_105=param.asInt();
}
BLYNK_WRITE(V107){
  t_107=param.asInt();
}
BLYNK_WRITE(V109){
  t_109=param.asInt();
}
BLYNK_WRITE(V111){
  t_111=param.asInt();
}
BLYNK_WRITE(V113){
  t_113=param.asInt();
}


BLYNK_WRITE(V100) {
 TimeInputParam t(param);
  
  for (int i = 1; i <= 5; i++) {
    if (t.isWeekdaySelected(i)) {
  if (t.hasStartTime())
  {
  t_127=t_101;
 
  }
  // Process stop time
  if (t.hasStopTime())
  {
   
  }
    }
  }
 
}

BLYNK_WRITE(V102) {
 TimeInputParam t(param);
   for (int i = 1; i <= 5; i++) {
    if (t.isWeekdaySelected(i)) {
  if (t.hasStartTime())
  {
  t_127=t_103;
  }
  // Process stop time
  if (t.hasStopTime())
  {
   
  }
    }
  }
 
}

BLYNK_WRITE(V104) {
 TimeInputParam t(param);
  for (int i = 1; i <= 5; i++) {
    if (t.isWeekdaySelected(i)) {
  if (t.hasStartTime())
  {
  t_127=t_105;
  }
  // Process stop time
  if (t.hasStopTime())
  {
   
  }
    }
  }
 
}

BLYNK_WRITE(V106) {
 TimeInputParam t(param);
  for (int i = 1; i <= 5; i++) {
    if (t.isWeekdaySelected(i)) {
  if (t.hasStartTime())
  {
  t_127=t_107;
  }
  // Process stop time
  if (t.hasStopTime())
  {
   
  }
    }
  }
 
}

BLYNK_WRITE(V108) {
 TimeInputParam t(param);
  for (int i = 6; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
  if (t.hasStartTime())
  {
  t_127=t_109;
  }
  // Process stop time
  if (t.hasStopTime())
  {
   
  }
    }
  }
 
}

BLYNK_WRITE(V110) {
 TimeInputParam t(param);
 for (int i = 6; i <= 7; i++) {
 
    if (t.isWeekdaySelected(i)) {
  if (t.hasStartTime())
  {
  t_127=t_111;
  }
  // Process stop time
  if (t.hasStopTime())
  {
   
  }
    }
  }
 
}





void sendSensor()
{
  float h = dht.readHumidity();
  float temp = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
 Blynk.syncAll();
  if (isnan(h) || isnan(temp)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, temp);
  Blynk.virtualWrite(V127,t_127);
  Blynk.virtualWrite(V99,"Setare periaode lucru WEKEWND");
  if (temp<=t_127-0.5)
    {
    digitalWrite(rel_centr,LOW);
  }
   else {
    digitalWrite(rel_centr,HIGH);
   }
  
  BLYNK_WRITE(V112) {
 TimeInputParam t(param);
 for (int i = 6; i <= 7; i++) {
 
    if (t.isWeekdaySelected(i)) {
  if (t.hasStartTime())
  {
  t_127=t_113;
  }
  // Process stop time
  if (t.hasStopTime())
  {
   
  }
    }
  }
 
}
       

  
}


void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  Blynk.connected();
  Blynk.syncAll();
  
   dht.begin();
  pinMode(rel_centr, OUTPUT);
  

  // Setup a function to be called every second
  timer.setInterval(2000L, sendSensor);

  
}

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

From your written description, screenshots and code (which doesn’t contain any useful comments), it’s impossible to:
A) understand what you’re trying to achieve and
B) what the issue is that you’re experiencing.

How do these numeric input widgets relate to your time intervals?

What virtual pins are these widgets attached to?

What EXACTLY does this mean, what is the ‘last widget’ and which virtual pin is it connected to?

I’d suggest that you edit your original post to make it more comprehensible.

Pete.

Sorry for my English.
At pin V127 it should be the value at pin V105 and not the value at pin V113.
I updated the images with the value of each pin attached as widget

I still don’t understand. You’ve not answered most of my comments, and I don’t understand your last post.

Pete.

Hi,
Thanks for the answers, I solved the problem. I had to use the RTC Widget.