Page 1 of 1

Simple Ruby problem

Posted: Wed May 29, 2013 7:44 am
by billv
I'm having a go at turning my green counting systems over to ruby,
but stuck with a some real simple logic.
ScreenShot249.png
ScreenShot249.png (4.74 KiB) Viewed 11083 times

Code: Select all

def event i,v,t

if v = 1 then output 0,t
end
end


This code gets me a trigger on each count.....???
I know I'm probably still thinking "Visual basic".... but i just don't get it :? .
If the value is =1 then give me a trigger.....seems a very straightforward instruction....
What am i missing here.....

Re: Simple Ruby problem

Posted: Wed May 29, 2013 8:36 am
by stw
"==" not "="

Re: Simple Ruby problem

Posted: Wed May 29, 2013 8:58 am
by Nubeat7
you couud also write just

Code: Select all

output nil if @in == 1

so you dont need an event (if it just should do that..)

Re: Simple Ruby problem

Posted: Wed May 29, 2013 9:15 am
by billv
Thanks guys....should have worked it out....nix showed me a good example of (==) a while
back in a on/off switch..I've been using it all the time as well.... :lol:
This is great.....now I've got some control in ruby....
Thanks.