[SOLVED] Timer widget (issues with shared pins)

Ok Pete thank you!
So I set this:

Timer V0 >>> Button V1 >>> Relay D1

and I use this example to control all writtend by Costas Ok?:

BLYNK_WRITE(V0){      // Timer widget                     
  if (param.asInt() == 1) {
    Blynk.virtualWrite(V1, 1); // button set to ON from timer
    Serial.println("Timer ON activated");
  }
  else{
    Blynk.virtualWrite(V1, 0); // button set to OFF from timer
    Serial.println("Timer OFF activated"); 
  }
  Blynk.syncVirtual(V1);      // sync virtualWrite 0 / 1 to button widget
}

How do you propose to make this code control your relay?
You’re not doing any digital writes to set a GPIO pin HIGH or LOW to actuate a relay.

What are you doing a Blynk.syncVirtual in your code snippet?

Pete.

Blynk.virtualWrite(V1, 1);

yes, is inusual, for me it’s also useless.

It is normal that the code I copied is only a part. I have copied only the crucial part of the code, which highlights the change of state of the timer on the Button. It is normal that I have to add this:

BLYNK_WRITE(V1){      // Button widget in SWITCH mode                     
  if (param.asInt() == 1) {
    digitalWrite(WEMOS_ON_BOARD_LED, LOW);
    Serial.println("LED ON");
  }
  else{
    digitalWrite(WEMOS_ON_BOARD_LED, HIGH); 
    Serial.println("LED OFF"); 
  }
}

So is your code working the way you want it to?

Pete.

I should try.
I’ll let you know. Thanks

I solve all! The problem was relay becuase I set my cable on relay NO-NC wrong.
Thank you

I have another small question please.
At the control of my button (when I press OFF), I add a simple command that send a total value of current producted from my solar panel to a graph. Obviously I send this value at the end of the day. In the future I’ll do by timer:

BLYNK_WRITE(buttonFaretto10W){  //control VIRTUAL buttonFaretto10W    V0  >> D4
  
  if(param.asInt()==1){
    digitalWrite(relayFaretto10WD4, HIGH);  // START RELAY 
  }else{
    digitalWrite(relayFaretto10WD4, LOW);   // STOP RELAY 
    Blynk.virtualWrite(correnteTotaleDayGraph, current_day);  // SEND VALUE TO GRAPH correnteTotaleDayGraph on V9
    current_day = 0; 
  }
}

I send value on virtual V9 and resest the current day for next day.
Now If I set on graph the value V9 I will not see the value why?
Let me know
Thank you