my first post, my first problem
I want to switch a waterpump on and off via a macro. It's no problem to do this manual with the following listing:
---------------------
- Code: Select all
M20600.txt:
// Macro to switch waterpump off
int Port;
int Pin;
Port = 1;
Pin = 9;
exec.Setoutpin(Port,Pin);
exec.AddStatusmessage(" Waterpump turned OFF ");
---------------------
- Code: Select all
M20601.txt:
// Macro to switch Waterpump on
int Port;
int Pin;
Port = 1;
Pin = 9;
exec.Clroutpin(Port,Pin);
exec.AddStatusmessage(" Waterpump turned ON ");
---------------------
In 2017 screenset I've created a button to switch the relais on and off:
The macro M20610.txt contains the following:
---------------------
- Code: Select all
bool buttonstate = AS3.Getbuttonstate(20610);
if (buttonstate)
{
AS3.Setcheckboxstate(false, 20601);
AS3.Switchbutton(false,20610);
}
else
{
AS3.Setcheckboxstate(true, 20600);
AS3.Switchbutton(true,20610);
}
---------------------
Clicking on the new button toggles between on and off, shown with pictures "CheckBox_Btn_Up.png and CheckBox_Btn_Down.png". This function of the button ist what I want, but nothing happens. The relais is not switching. I don't know why. I assumed that the lines "AS3.Setcheckboxstate(false, 20601);" and "AS3.Setcheckboxstate(true, 20600);" be called alternately.
I think, it's a very simple error that I made. But I don't find it. It's my first try with UCCNC-macros. Please be lenient with my programming skills (and my poor english)
Best Regards
Peter