Simple Ruby problem

For general discussion related FlowStone
Post Reply
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Simple Ruby problem

Post 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 11080 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.....
stw
Posts: 111
Joined: Tue Jul 13, 2010 11:09 am
Contact:

Re: Simple Ruby problem

Post by stw »

"==" not "="
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Simple Ruby problem

Post 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..)
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: Simple Ruby problem

Post 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.
Post Reply