Hello Guest it is March 29, 2024, 10:45:02 AM

Author Topic: GetProperty LED  (Read 2654 times)

0 Members and 1 Guest are viewing this topic.

GetProperty LED
« 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
Chad Byrd

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: GetProperty LED
« Reply #1 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
New For 2022 - Instagram: dazthegas
Re: GetProperty LED
« Reply #2 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!!
Chad Byrd