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

Basic loop on Ruby

For general discussion related FlowStone

Basic loop on Ruby

Postby borodadada » Thu Jun 20, 2013 11:21 am

Hello, my simle code on ruby not work in flowstone, but work on Ruby language.
a = 1
b = 2
c = 3

loop do
puts a
sleep 1
puts b
sleep 1
puts c
sleep 1
end

original

flowstone

a = 1
b = 2
c = 3

loop do
output a
sleep 1
output b
sleep 1
puts c
output c
end

All die... FL crash....
trying to write a simple sequence generator

Method Sleep kill ruby.
borodadada
 
Posts: 47
Joined: Sun Jun 02, 2013 5:58 pm

Re: Basic loop on Ruby

Postby Nubeat7 » Thu Jun 20, 2013 11:55 am

afaik sleep dont work here in fs, but you can try to use time.. to delay the the output..

or you use an array with you values an read the index with a timed counter..
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Basic loop on Ruby

Postby borodadada » Thu Jun 20, 2013 12:20 pm

time - FlowStone? or standart ruby class?
I have a task to build an infinite loop that would print the value of variable intervals.
borodadada
 
Posts: 47
Joined: Sun Jun 02, 2013 5:58 pm

Re: Basic loop on Ruby

Postby Nubeat7 » Thu Jun 20, 2013 1:48 pm

so a,b & c are changing constantly and you want to read them every second ? maybe you could post a schematic to see what you want exactly

if you use the event method you can use time, just watch the userguide, and there is also a ruby ticker in the toolbox where you can choose variable ticking time..
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Basic loop on Ruby

Postby borodadada » Thu Jun 20, 2013 2:05 pm

if start ruby language
a = 1
b = 2
c = 3

loop do
puts a
sleep 1
puts b
sleep 1
puts c
sleep 1
end

resultat
1
2
3
1
2
3
..... + pause, infinite
I need exactly the same effect

I have a module that I need to constantly send information cycle, the size may be different, which will show itself, and I can not understand how can implement.

ticker module, but it sends a true or false.
bad in that Ruby can not write cycles ...
borodadada
 
Posts: 47
Joined: Sun Jun 02, 2013 5:58 pm

Re: Basic loop on Ruby

Postby MyCo » Thu Jun 20, 2013 3:35 pm

Here is a small example for timed events. That's the FS way to do "sleep"
Attachments
timed loop (MyCo).fsm
(441 Bytes) Downloaded 1123 times
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Basic loop on Ruby

Postby borodadada » Thu Jun 20, 2013 4:03 pm

thank you it works! I would like to in the future, more similar to the Ruby language
borodadada
 
Posts: 47
Joined: Sun Jun 02, 2013 5:58 pm


Return to General

Who is online

Users browsing this forum: No registered users and 101 guests

cron