Switches and Selecting

paperluffy's icon

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?

ahmet kizilay's icon
MIB's icon

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...

brendan mccloskey's icon

And there's a Debounce example sketch too

Tobias Rosenberger's icon

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:

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

brendan mccloskey's icon

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?

brendan mccloskey's icon