Hello Guest it is October 23, 2019, 08:39:38 PM

Author Topic: GetProperty LED  (Read 1610 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

*
  •  750 750
  • 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
Theres always time for a choccy biccy
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