Analog Output button macro

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Analog Output button macro

Postby krsykes23 » Mon May 16, 2022 8:00 am

I need a screenset button that controls the Analog Output (AO1) to my Air Blow on the ATC.

I have successfully added a 5v relay which is assigned to AO1 on the AXBB-E. It works just as expected using #1 in the Analog Output settings and an MDI command of #1=32768 (5v) to turn it on and #1=0 to turn it off.

But I need to assign it to a button on the screenset. Is this possible? Something like exec.Setoutpin, but obviously for Analog Output 1.

Also, as well as the button, I'd like to add the code to the M6 macro, to set the Air Blow at SafeZ before lowering to pick up the new tool.
krsykes23
 
Posts: 43
Joined: Wed Apr 27, 2022 9:29 am

Re: Analog Output button macro

Postby krsykes23 » Mon May 16, 2022 8:45 am

I've just figured it out!

Created the button as 20009, then created a macro 20009.

_________________________________________
// Air Blow On-Off

bool buttonstate = AS3.Getbuttonstate(20009);
if (!buttonstate)
{
AS3.Switchbutton(true,20009);
exec.Code("#1=32768"); // 5v ON
}
else
{
AS3.Switchbutton(false,20009);
exec.Code("#1=0"); // 0v OFF
}
_________________________________________

I'll now try to add that to the M6 (ATC) macro!
krsykes23
 
Posts: 43
Joined: Wed Apr 27, 2022 9:29 am


Return to Macros

Who is online

Users browsing this forum: No registered users and 9 guests