Virtual LEDs and function

Here is where you can request new features or special features.

Virtual LEDs and function

Postby Tea_Cypher » Sun Jan 16, 2022 10:28 am

I will admit I am not really the best with all this stuff but to explain.

A useful function would be Virtual LED and function, LEDs and functions without any pre arranged usage, these could be called via a macro or set by a button. and pin set in the I/O page.

Why: At the moment you can address individual ports and pins by the set command, and like wise get inputs, how ever with virtual LED anf function, the macro or button can call the virtual, which the user can then direct to a specific pin, with out needing to edit or create a macro.

Best Regards

Ross
Tea_Cypher
 
Posts: 16
Joined: Mon Oct 04, 2021 9:35 pm

Re: Virtual LEDs and function

Postby ger21 » Sun Jan 16, 2022 2:04 pm

You can already do that with a very simple button macro.
Create a "user" LED using any number that's not reserved, currently above #309 (and less than 1000).
Then create a button numbered between 20000 and 21999.
Say your LED is #999.
If you just wanted to turn the LED on with a button, the button macro would be

Code: Select all
AS3.SetLED(true, 999);


However, you'd most likely want to toggle the LED, so you'd use this code:

Code: Select all
if (AS3.GetLED(999))
     {
     AS3.SetLED(false, 999);
     }
else
     {
     AS3.SetLED(true, 999);
     }


If the button number was 20001, you'd save the macro with the name M20001.txt

Then you'd use an Output Trigger and assign your port and pin to LED #1001, and the button will toggle the output pin.

And to make it even easier, you don't actually need to add the LED, so it is indeed "Virtual". Just use the LED# in both your macro and Output Trigger, and it will still work, even without the LED on the screen.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2806
Joined: Sat Sep 03, 2016 2:17 am

Re: Virtual LEDs and function

Postby johnsattuk » Sun Feb 06, 2022 2:19 pm

ger21 wrote:You can already do that with a very simple button macro.
Create a "user" LED using any number that's not reserved, currently above #309 (and less than 1000).
Then create a button numbered between 20000 and 21999.
Say your LED is #999.
If you just wanted to turn the LED on with a button, the button macro would be

Code: Select all
AS3.SetLED(true, 999);


However, you'd most likely want to toggle the LED, so you'd use this code:

Code: Select all
if (AS3.GetLED(999))
     {
     AS3.SetLED(false, 999);
     }
else
     {
     AS3.SetLED(true, 999);
     }


If the button number was 20001, you'd save the macro with the name M20001.txt

Then you'd use an Output Trigger and assign your port and pin to LED #1001, and the button will toggle the output pin.

And to make it even easier, you don't actually need to add the LED, so it is indeed "Virtual". Just use the LED# in both your macro and Output Trigger, and it will still work, even without the LED on the screen.


Hi Gerry
Could this be part of a devious solution to Diagonal moves :?:
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm


Return to Feature Request

Who is online

Users browsing this forum: No registered users and 6 guests

cron