Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Simple Ruby problem

For general discussion related FlowStone

Simple Ruby problem

Postby billv » Wed May 29, 2013 7:44 am

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 9407 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.....
billv
 
Posts: 1146
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Simple Ruby problem

Postby stw » Wed May 29, 2013 8:36 am

"==" not "="
stw
 
Posts: 111
Joined: Tue Jul 13, 2010 11:09 am

Re: Simple Ruby problem

Postby Nubeat7 » Wed May 29, 2013 8:58 am

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..)
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Simple Ruby problem

Postby billv » Wed May 29, 2013 9:15 am

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


Return to General

Who is online

Users browsing this forum: No registered users and 32 guests