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

Ruby array queue ?

For general discussion related FlowStone

Ruby array queue ?

Postby kortezzzz » Fri May 08, 2020 12:32 pm

Hi,
I've tried using the green queue primitive for a sensitive project that needs a decent accuracy but couldn't perform a full control on it. So wondered maybe Ruby can be the answer. The Ruby module should actually do a very simple task:
Receive a given array and push each of the indexes forward whenever it gets triggered. For instance, if the array is

4
5
7
9
13

It will output the integer 4 on the first trigger, then output the integer 5 on the second trigger, then 7 and so on until the array ends. Array's end should cause it stop pushing anything until a "reset" trigger received.

Any ideas?
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Ruby array queue ?

Postby tektoog » Fri May 08, 2020 11:41 pm

Hey,
This does, I think, what you're asking for ;)

TekTooG - Triggered values in queue.fsm
(1.51 KiB) Downloaded 787 times


No Ruby there though... :o :oops:
Last edited by tektoog on Fri May 08, 2020 11:42 pm, edited 1 time in total.
"Essential random order for chaotic repetitive sequences"
User avatar
tektoog
 
Posts: 141
Joined: Sat Oct 30, 2010 11:49 pm
Location: Geneva - Switzerland

Re: Ruby array queue ?

Postby tiffy » Fri May 08, 2020 11:41 pm

Here is a better version in Green Primitives than the first one I uploaded.
Attachments
Array - FIFO 2.fsm
(2.75 KiB) Downloaded 767 times
Last edited by tiffy on Sat May 09, 2020 1:05 pm, edited 4 times in total.
User avatar
tiffy
 
Posts: 400
Joined: Wed May 08, 2013 12:14 pm

Re: Ruby array queue ?

Postby tulamide » Sat May 09, 2020 1:28 am

kortezzzz wrote:Hi,
I've tried using the green queue primitive for a sensitive project that needs a decent accuracy but couldn't perform a full control on it. So wondered maybe Ruby can be the answer. The Ruby module should actually do a very simple task:
Receive a given array and push each of the indexes forward whenever it gets triggered. For instance, if the array is

4
5
7
9
13

It will output the integer 4 on the first trigger, then output the integer 5 on the second trigger, then 7 and so on until the array ends. Array's end should cause it stop pushing anything until a "reset" trigger received.

Any ideas?
That's called 'fifo' and describes a buffer that holds a certain number of data and spits out the oldest first ( "First In First Out" )

Here's an example in Ruby.
Attachments
fifo.fsm
(555 Bytes) Downloaded 773 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby array queue ?

Postby kortezzzz » Sat May 09, 2020 10:06 am

Guys, Thanks you so much for the beautiful examples 8-) This is classic "straight to toolbox" must have module.
Although tula's ruby one is the most elegant solution and probably the most CPU saver, I really loved the functionality of tiffy's and tektoog's green solution. So I made another progress and added to tektoog's one's trog's ruby counter which allows up\down option. Hope you like it :)
Attachments
TekTooG - Triggered values in queue_ KORTEZZZZ EDIT.fsm
Made with 3.0.6
(4.38 KiB) Downloaded 779 times
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Ruby array queue ?

Postby tektoog » Sat May 09, 2020 12:44 pm

Hey,
Good add ;)
I think it can still be optimized a bit ;)
check this one, notes are in there :) ;)



Take care,
TekTooG
"Essential random order for chaotic repetitive sequences"
User avatar
tektoog
 
Posts: 141
Joined: Sat Oct 30, 2010 11:49 pm
Location: Geneva - Switzerland

Re: Ruby array queue ?

Postby kortezzzz » Sat May 09, 2020 2:37 pm

tektoog wrote:I think it can still be optimized a bit ;)
check this one, notes are in there :)


Thanks Tektoog :)
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm


Return to General

Who is online

Users browsing this forum: No registered users and 71 guests

cron