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

Comparing identical values in Ruby

For general discussion related FlowStone

Comparing identical values in Ruby

Postby kortezzzz » Sat Oct 18, 2014 6:55 am

Hi,
Once again, a Ruby challenge:
I need a simple ruby module with 1 in-1out floats that responds to the incoming data whenever a value is sent to it, even if the sent value has sent twice in raw. For instance, if i press a key that sends the float value "2" twice, the module should recognize that. On the first press, it should output "2", but on the second, it should output "3", if any other new key is pressed ( even if its "2" again!) after the the double press, then it will output the new value, untill this value is double-pressed again. Any suggestion?
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Comparing identical values in Ruby

Postby KG_is_back » Sat Oct 18, 2014 8:51 am

You mean something like this?
Attachments
ifequaltoprev.fsm
(337 Bytes) Downloaded 669 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Comparing identical values in Ruby

Postby kortezzzz » Sat Oct 18, 2014 7:46 pm

Sorry for the late respond. Just tested it; Works amazing! :)
Thanks a lot KG. And from 1 example to another, I'm slowly learning how Ruby's logic translated into an actual code.
Really great :)
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Comparing identical values in Ruby

Postby kortezzzz » Sat Oct 18, 2014 9:33 pm

Last principle question for today: how do we block values in ruby from passing out? Lets say we have a code with 1 midi in+1float in and1 midi out, and we want to completely block the midi signal from passing out when the float value =1. How do we do it? As far as i understand, "else 0" doesnt blocks, but just sends a zero to the output (bad solution, dont it :?: )
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm


Return to General

Who is online

Users browsing this forum: Google [Bot] and 71 guests