Forums > MaxMSP

If statement not switching btwn movies

February 15, 2011 | 11:50 am

Hi, I’m trying to switch videos depending on the value from an arduino input which i can do fine when I simply switch but is not working when I use the if statement. Can anyone help?

— Pasted Max Patch, click to expand. —
February 15, 2011 | 12:24 pm

if is an object, not a message. A new object is created when pressing the "N" letter on your keyboard while a message is created with a "M".

Anyway, for your patch, I’d use a sel:

— Pasted Max Patch, click to expand. —
February 15, 2011 | 11:14 pm

Thanks for pointing out my use of M instead of N Patrick – this had me really puzzled. I am going to stick with the if statement though because I need to stream the inputs according to ranges so I am using 2 if statements and one split object.

— Pasted Max Patch, click to expand. —
February 19, 2011 | 11:51 am

I’ve got the if and split objects working fine with imovie (see post above) but am trying to apply the same logic to a unsuccessfully. I’m going to post this issue in the jitter forum too as I’m not sure where the problem lies. Any ideas? Thanks

— Pasted Max Patch, click to expand. —
February 19, 2011 | 1:21 pm

Should the 2nd if statement actually be a > rather than a < ?

February 19, 2011 | 1:36 pm

Yes it should but that’s not the problem. I just can’t get the if objects to work but the split object is working so I’m going to replace the ifs with splits. Thanks for responding anyway.

February 19, 2011 | 9:41 pm

Kurt Kalske came up with this response which works – Thanks again Kurt:

"There were two errors in your patch. The "if" statement requires a typed variable, "$i1" instead of just "$1".
Also there’s a logic error: you want to test when your variable transitions into the next chosen range, not constantly reporting what range it is in. Try the example below.

Multiple boolean conditions are very difficult in Max. I tend to do this sort of thing in Javascript, because it’s much more straightforward in text code.

— Pasted Max Patch, click to expand. —
Viewing 7 posts - 1 through 7 (of 7 total)

Forums > MaxMSP