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 ?
7 posts
• Page 1 of 1
Ruby array queue ?
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?
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?
-
kortezzzz - Posts: 763
- Joined: Tue Mar 19, 2013 4:21 pm
Re: Ruby array queue ?
Hey,
This does, I think, what you're asking for
No Ruby there though...
This does, I think, what you're asking for
No Ruby there though...
Last edited by tektoog on Fri May 08, 2020 11:42 pm, edited 1 time in total.
"Essential random order for chaotic repetitive sequences"
-
tektoog - Posts: 141
- Joined: Sat Oct 30, 2010 11:49 pm
- Location: Geneva - Switzerland
Re: Ruby array queue ?
Here is a better version in Green Primitives than the first one I uploaded.
- Attachments
-
- Array - FIFO 2.fsm
- (2.75 KiB) Downloaded 766 times
Last edited by tiffy on Sat May 09, 2020 1:05 pm, edited 4 times in total.
-
tiffy - Posts: 400
- Joined: Wed May 08, 2013 12:14 pm
Re: Ruby array queue ?
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" )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?
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 ?
Guys, Thanks you so much for the beautiful examples 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
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
-
kortezzzz - Posts: 763
- Joined: Tue Mar 19, 2013 4:21 pm
Re: Ruby array queue ?
Hey,
Good add
I think it can still be optimized a bit
check this one, notes are in there
Take care,
TekTooG
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"
-
tektoog - Posts: 141
- Joined: Sat Oct 30, 2010 11:49 pm
- Location: Geneva - Switzerland
Re: Ruby array queue ?
tektoog wrote:I think it can still be optimized a bit
check this one, notes are in there
Thanks Tektoog
-
kortezzzz - Posts: 763
- Joined: Tue Mar 19, 2013 4:21 pm
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 59 guests