Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started 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
-
You seem to be missing an "=" after the local FeedLeftLED
local FeedLeftLED = scr.GetProperty("FeedLeftLED", "Value")
if (FeedLeftLED == "1") then
scr.SetProperty("FeedLeftLED", "Value", "0")
else
scr.SetProperty("FeedLeftLED", "Value", "1")
end
DazTheGas
-
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!!