Need logical calculation/control actor suggestion



  • Hi all,

    I am trying to find the right actor to interpret more than one value of "if then": I have 8 sensors each outputting 1 when on, 0 when off. I'm trying to find an actor that can do "if all 8 values are 0, then output 1 or trigger".

    I've tried the Lookup actor, but it doesn't seem to do what I want.

    I'm sure this is quite easy, but I can't seem to find the right actor for it.

    Thanks very much


  • Tech Staff

    Comparator actor?  6d0d65-screen-shot-2014-10-21-at-16.56.12.png



  • Hi @Skulpture,

    I need to compare 8 values though. If all 8 values = 0 then output 1.

    If there any actor that can compare more than 1 values?

    Thanks!


  • Tech Staff

    @chimerik

    this is quite easy: use four calculator actors for the input values, then another two to get the summary of two pairs and another one to get the summary from them. Then take a comparator actor that is looking for zero, if zero then the output is one otherwise zero. See attached image.

    Best
    Michel
    62cf46-screen-shot-2014-10-21-um-18.19.26.png



  • Seems like an ideal place for the javascript actor.

    Also very minor bug report - it says compatator in the help for the comparator actor (see Skulptures post above)


  • Michel was faster...



  • @[Michel](http://troikatronix.com/troikatronixforum/profile/9/Michel) 
    YES!!! This is it! So simple, but need intelligent brains to show me the way. Thanks so much!


  • Or paste the following into a javascript actor with 8 inputsfunction main(){ total=0; for (i=0;i<8;i++) { total+=arguments[i] } return total>0; }


  • Tech Staff

    Well spotted @gavspav ;)


  • Tech Staff

    The javascript method is great.

    But another very simple one can be setup using the 'Lookup' actor.
    It will output 0 if the 'compare' input is not found in the X (eight for this case) inputs.
    Otherwise it will say which input matches the 'compare'
    If your binary values run into eight value inputs, and you compare '1', you will receive a '0' if all of your eight values are not 1, and a value between 1 and 8 if there is a match.


  • Thats great too!

    Another way - how about the Maximum actor with 8 inputs. 
    The advantage of this is that the 8 value inputs are 'active' - with the lookup actor you have to keep sending '1' to the compare input every time you want the actor to do its thing.
    Sorry if I'm getting a bit anal. On the same note here's a rewrite of the javascript:
    function main()
    {
    for (i=0;i<8;i++) {
    	if (arguments[i]==1) {
    		return 1;
     		break;
    		}
    	}
    return 0;
    }

  • Tech Staff

    @gavspav

    yep the maximum actor is even simpler to setup.


  • Tech Staff

    @gavspav

    yes,Maximum is an easier choice than lookup.
    Its probably the easiest native Isadora solution.


  • Wow, thank you @DusX & @Michel!
    I didn't know about the Maximum actor. this is so great! yes, the easiest solution! thanks so much.



  • and thank you @gavspav 

    I just realized you've already suggested it as well. i'll try the javascript actor too, just for fun. cheers.

  • Tech Staff

    @chimerik

    the tutorial on Javascript for Isadora might be worth a read.

    http://troikatronix.com/support/kb/getting-started-with-javascript/


Log in to reply
 

Looks like your connection to TroikaTronix Community Forum was lost, please wait while we try to reconnect.