Hello,
I am working on a project involving a 7" Nextion display and Arduino Mega.
They control motorized ball valves for an air system.
You can see my previous post here: I/O "States" not Maintaining - Programming Questions - Arduino Forum
Since then I have added a RTC so that at specific times of day, the main valve will turn on/off saving the compressor and machinery excess work.
The RTC works great and turns my relay on/off atthe right time, but since the main control is from the nextion display I want to change the button state during that time as well so everything is copacetic.
Here is the code in question:
if((now.hour()==13) && now.day()!=(1||7)){
if(valve_states[0]==false){
myNextion.sendCommand("v0.val=0");
valve_states[0] = true;
digitalWrite(valve_pins[0], LOW);
}
}
if((now.hour()==14) && now.day()!=(1||7)){
if(valve_states[0]==true){
myNextion.sendCommand("v0.val=1");
valve_states[0] = false;
digitalWrite(valve_pins[0], HIGH);
}
}
v0 is the name of the button on my nextion, I have also tried using its ID like so:
myNextion.sendCommand("1.val=0");
If I remember correctly my nextion library may be different than most, but I have a pincode screen and logic that works great. The arduino reads the pincode inputs and if they are correct it sends the nextion to the valve control screen.
myNextion.sendCommand("page valves");
I have looked through the nextion instruction set and just cannot find the appriate command to change a button state...
Thanks for your help in advanced!!