===== Add a Button to toggle output pin with indication ===== * Need to add a button on main screen of **Tomas2** profile instead of "CV" button. * The button should toggle output #6 * The button should have built-in LED indicator to show current Output Pin state. {{mycnc::mycnc-add-toggle-output-.png}} The button code in **cnc-screen.xml** will look as * **where="work-toolbar"** - Widget name to put the button * **type="xbutton"** - Type for button with buil-in LED indicator * height="60" - Size for button. It's supposed square button if No "width" attribute given * image="outputs/transistor-off" - Skin image for the button * xattr="2;38;20;20;led;green;round" - Built-in Led indicator type, color, position and size * address="outputs" number="6"- Address (inputs or outputs) and pin number to show state {{mycnc::mycnc-add-toggle-output--1.png}} Software PLC procedure source code to toggle output pin will be as follow main() { a=portget (0x406); //read current state of output #6 if (a==0) {portset(6);} else {portclr(6);}; exit(99); }; To add Software PLC procedure - * Go to Software PLC tab * Press **+** (Add) button and enter PLC procedure name {{mycnc::mycnc-add-toggle-output--3.png}} * Fill the procedure source code * Press 2 buttons on the right - **Build All** and **Save** to save sourece code and build PLC binary file {{mycnc::mycnc-add-toggle-output--2.png}}