Forums > MaxMSP

Switches and Selecting

November 17, 2012 | 9:02 pm

Hello, I was wondering if anyone could think of any solutions for this problem I am having. Unfortunatly it is a hardware thing so I dont think sharing the patch would help any.

Anyway Im using a switch through the arduino board to talk to max. The problem is the switch sends lots of on offs (1, 0) with just one click. I want to take just one of those ons to trigger the object in max. The hard part is the ons/off it sends come out as a random number between usually 10-50 (using a counter) so I cant really just use a select object if you understand what Im saying.

So what is another way to take just 1 onoff/bang from a random number?


November 18, 2012 | 9:21 am

did you try using the [next] object?

http://cycling74.com/docs/max6/dynamic/c74_docs.html#next



MIB
November 18, 2012 | 9:57 am

I am a bit confused…. first you say it’s many 0s and 1s, then it is between 10-50….
if it is 0s and 1s it is very easy… just use the [change] object to filter out repetitions…


November 18, 2012 | 10:31 am

And there’s a Debounce example sketch too


November 18, 2012 | 10:33 am

i have a somehow related, but maybe maxuino-specific question:

i have an analog rotation sensor connected to an analog pin and no problem to send it with the following code f.e. to max:

http://www.dfrobot.com/wiki/index.php?title=Analog_Rotation_Sensor_V2_%28SKU:_DFR0058%29

i get the values between 0 and 1023 into max via the serial-object, just as the sensor is supposed to work, no problems here.
but if i use maxuino, which scales the values between 0. and 1., i always get oscillating values, even if i do not turn the shaft, that means i get f.e. 0.123, 0.124, 0.123, 0.124, 0.123 and so on (expected behavior would be just to get 0.123 once f.e.). any hints what might be the problem via maxuino? i have the same problem when using the new "ArduinoMax_InOut_forDummies" as well.

thanks


November 18, 2012 | 11:56 am

It could just be that scaling down from 1023 to 1. is amplifying any inherent sensor noise. Try scaling back up to 1023 perhaps. Can you provide a link to ArduinoMax_InOut_forDummies btw?


November 18, 2012 | 12:06 pm

…found it


Viewing 7 posts - 1 through 7 (of 7 total)