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

Blynk.setProperty Styled Button

I am trying to set the “offBackColor” on my styled button, the color and label will not change when I call it from my procedure. However it will only change if I physically touch the button at BLYNK_WRITE(V14) in my code. Why will it not change.

I have done some background searching at the links below and more but no solution…


Styled Button (custom colours/intensity)

    //END OF MANUAL
     xor_result = nowseconds ^ Prog_1_Zone_Timer[13]; //check if end of Manual 
     if(xor_result == 0){ // Zone 4 end time
       Serial.println("end of manual");
       Blynk.setProperty(V14, "offBackColor", BLYNK_YELLOW);
       Blynk.setProperty(V14, "offLabel", "OFF");
       Blynk.virtualWrite(V41,"  --:--:--");
     }

//...........................................................................................................................
//Manual Overide
BLYNK_WRITE(V14){ 
  
    if (param.asInt()== 1){
      Prog_1_Total_Time(2); // calculate manual end time
      Setup_Time_Table(nowseconds); // manual start Prog 1
      Update_Zone_PROG_1(); // start the timer
    }
    else{
      Blynk.setProperty(V14, "offBackColor", BLYNK_YELLOW);
      Blynk.setProperty(V14, "offLabel", "OFF");
      Blynk.virtualWrite(V41,"  --:--:--");
    }
    
 }

Is your button in the Off state when you are applying these changes?

This statement…

implies that it’s On, and touching it will turn it Off and use the new properties.

Are you meaning that you only see the changes if you turn the button On then Off again?
If so, what happens if you do a Blynk.virtualWrite(V14,0); after your setProperty commands?

Pete.

Thanks Pete,
Brilliant Blynk.virtualWrite(V14,0) worked. But I don’t understand why, is it documented somewhere? Maybe I missed it…

It was just an idea to get the button widget to refresh itself - glad it worked!

Pete.