Button state from on to off from hardware

Hello, i am trying to make my diesel heating automatic on my boat. I want to have to function MANUAL and AUTO, and use 2 button

, but i need when i choose on MANUAL button ON, AUTO button must be OFF, it is posible? I try with Blynk.virtualWrite(V43, LOW);
but it seems it not working. Somebody mayby know somting about this?

Maybe use Segmented switch instead?

How i should use segmented switch? Can you explain lit bit more details?

Ok i foud already, i will try and will update my progress

If you post your code, it may aid in us assisting you.

Blynk.virtualWrite(V43, LOW); should set the switch to “off”, per say, but will not execute the BLYNK_WRITE(V43){ } portion of code. You need to do a Blynk.syncVirtual(V43); after you set it low in order for the BLYNK_WRITE function to run.

empty

You need to edit your post to format the code correctly…

Blynk - FTFC

There appears to be quite a few issues with your code itself, but I’ll keep those comments to myself until you’ve edited your post.

Pete.



#include "includes.h"
#define BLYNK_PRINT Serial

char auth[] = "***************************";

BlynkTimer timer, timer1;



WidgetRTC rtc;






BLYNK_CONNECTED() 
{
  
  rtc.begin();
}


void setup()
{
  
  Serial.begin(115200);
  pinMode(D6,OUTPUT);
  pinMode(D1,OUTPUT);
  Blynk.begin(auth, "********", "************");
  

  ArduinoOTA.setHostname("Webasto controller(ESP8266)");
  ArduinoOTA.begin();
  timer1.setInterval(500000L, checkForUpdates);
  timer.setInterval(1000L, clockDisplay);
  
}

void loop()
{
  Blynk.run();
  ArduinoOTA.handle();
  timer.run();
  timer1.run();
  
}



byte manual_mode = 0;
byte auto_mode = 0;
byte manual_button_state = 0;
byte manual_cold_warm_state = 0;
String currentTime ;
String currentDate ;
float set_temperature = 0;
float temperature_kitchen = 35;

BLYNK_WRITE (V42)
{
  manual_button_state = param.asInt();
}
BLYNK_WRITE (V44)
{
  set_temperature = param.asInt();
}

BLYNK_WRITE (V31)
{
  temperature_kitchen = param.asInt();
}

BLYNK_WRITE (V43)
{
  manual_cold_warm_state = param.asInt();
}

BLYNK_WRITE (V40)
{
   
  switch (param.asInt())
  {
    case 1:
    {
      manual_mode = 1;
      auto_mode = 0;
      terminal.println("Manual mode pressed");
      terminal.println("Date and time: " + currentTime + " " + currentDate);
      terminal.flush();
    break;
    }
    case 2:
    { 
      manual_mode = 0;
      auto_mode = 1;
      terminal.println("Auto mode pressed");
      terminal.println("Date and time: " + currentTime + " " + currentDate);
      terminal.flush();
      break;
    }
  }
  
}





void webasto_on_cold()
{
  analogWrite(D6, 700);
  digitalWrite(D1, HIGH);
  terminal.println("Webasto on cold mode");
  terminal.println("Date and time: " + currentTime + " " + currentDate);
  terminal.flush();
}

void webasto_on_warm()
{
  analogWrite(D6, 350);
  digitalWrite(D1, HIGH);
  terminal.println("Webasto on warm mode");
  terminal.println("Date and time: " + currentTime + " " + currentDate);
  terminal.flush();
}

void webasto_off()
{
  analogWrite(D6, 700);
  digitalWrite(D1, LOW);
  terminal.println("Webasto Off");
  terminal.println("Date and time: " + currentTime + " " + currentDate);
  terminal.flush();
}

void auto_webasto_mode()
{
  if(manual_button_state == 1)
    {    
     if(auto_mode == true)
     {
      
    
      
      if(set_temperature > temperature_kitchen)
      {
        webasto_on_warm();
      }
      else
      {
        webasto_on_cold();
      }
    }
    
  }
  else
    {
      webasto_off();
    }
}

void manual_webasto_mode()
{
  if(manual_button_state == 1)
    {    
     if(manual_mode == true)
     {
      
    
      
      if(manual_cold_warm_state == 1)
      {
        webasto_on_warm();
      }
      else
      {
        webasto_on_cold();
      }
    }
    
  }
  else
    {
      webasto_off();
    }
}

void clockDisplay()
{
   currentTime = String(hour()) + ":" + minute() + ":" + second();
   currentDate = String(day()) + " " + month() + " " + year();
  manual_webasto_mode();
  auto_webasto_mode();
  Blynk.virtualWrite(V46, set_temperature);
}

Now is evrything working, it is not my full code.