This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

toggle
#1
hi
i have a signal from a  proximity o-1 state i would like every circle  (o-1) to have a toogle state and second this toggle i would like to is update from status object of the load .
thanks in advance
Reply
#2
Can you explain what task do you have in more detail?
Reply
#3
(22.02.2019, 10:07)admin Wrote: Can you explain what task do you have in more detail?

i have a signal from a  proximity o-1 state ,every movement it give me signal 1 and when stop movement it give me 0 this is a cycle.
i would like when i have a cycle from proxymity with a script to give me a toggle operation, alongside the toggle operation i want to be informed for the state from status feedback if it has value 0 or1  .
thanks in advance
Reply
#4
(20.02.2019, 20:20)balatis Wrote: hi
i have a signal from a  proximity o-1 state i would like every circle  (o-1) to have a toogle state and second this toggle i would like to is update from status object of the load .
thanks in advance

Try this..

Code:
--Get proximity value
value=event.getvalue()

-- 'Light Feedback' is the address/name of the actual state of the load
-- 'Light OnOff' is the address/name of the actual load  
if value then
  lightFB = grp.getvalue('Light Feedback')
  grp.write('Light OnOff', not lightFB)
end
Reply
#5
(22.02.2019, 19:44)gtsamis Wrote:
(20.02.2019, 20:20)balatis Wrote: hi
i have a signal from a  proximity o-1 state i would like every circle  (o-1) to have a toogle state and second this toggle i would like to is update from status object of the load .
thanks in advance

Try this..

Code:
--Get proximity value
value=event.getvalue()

-- 'Light Feedback' is the address/name of the actual state of the load
-- 'Light OnOff' is the address/name of the actual load  
if value then
  lightFB = grp.getvalue('Light Feedback')
  grp.write('Light OnOff', not lightFB)
end

Ιt it work for one cycle only
Reply
#6
The event script should run on proximity sensor GA.

Does the feedback object works correctly? Are you trying to toggle it too fast?

Try changing the code as below in order to give it some time to update the feedback object

Code:
--Get proximity value
value=event.getvalue()

-- 'Light Feedback' is the address/name of the actual state of the load
lightFB = grp.read('Light Feedback')
os.sleep(0.5)

-- 'Light OnOff' is the address/name of the actual load  
if value then  
lightFB = grp.getvalue('Light Feedback')
grp.write('Light OnOff', not lightFB)
end


If it doesn't work give me a call

BR 
George
Reply
#7
(22.02.2019, 22:09)gtsamis Wrote: The event script should run on proximity sensor GA.

Does the feedback object works correctly? Are you trying to toggle it too fast?

Try changing the code as below in order to give it some time to update the feedback object

Code:
--Get proximity value
value=event.getvalue()

-- 'Light Feedback' is the address/name of the actual state of the load
lightFB = grp.read('Light Feedback')
os.sleep(0.5)

-- 'Light OnOff' is the address/name of the actual load  
if value then  
lightFB = grp.getvalue('Light Feedback')
grp.write('Light OnOff', not lightFB)
end


If it doesn't work give me a call

BR 
George
thanks George!
Reply


Forum Jump: