Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Cbyrdtopper on March 18, 2016, 04:23:03 PM

Title: GetProperty LED
Post by: Cbyrdtopper on March 18, 2016, 04:23:03 PM
Hello All,
I can't seem to figure out how to get the "value" of an LED and compare it.
I have a button that I'm setting up to toggle an LED on and off.  Here is the code I have written, when I hover over the Variable it says "ERROR".  Any thoughts??

local FeedLeftLED scr.GetProperty("FeedLeftLED", "Value")
    if (FeedLeftLED == 1) then
            scr.SetProperty("FeedLeftLED", "Value", "0")
        else
            scr.SetProperty("FeedLeftLED", "Value", "1")
    end

-Chad
Title: Re: GetProperty LED
Post by: DazTheGas on March 18, 2016, 06:45:03 PM
You seem to be missing an "=" after the local FeedLeftLED

Code: [Select]
local FeedLeftLED = scr.GetProperty("FeedLeftLED", "Value")
    if (FeedLeftLED == "1") then
            scr.SetProperty("FeedLeftLED", "Value", "0")
        else
            scr.SetProperty("FeedLeftLED", "Value", "1")
    end

DazTheGas
Title: Re: GetProperty LED
Post by: Cbyrdtopper on March 21, 2016, 08:15:54 AM
Thanks DazTheGas
I don't know how I missed that!! 
Here is the corrected and working code!

local FeedLeftLED = scr.GetProperty("FeedLeftLED", "Value")
    if (FeedLeftLED == "1") then
            scr.SetProperty("FeedLeftLED", "Value", "0")
        else
            scr.SetProperty("FeedLeftLED", "Value", "1")
    end

Thanks for the help!!