Switches and Selecting

Nov 17, 2012 at 9:02pm

Switches and Selecting

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?

#63779
Nov 18, 2012 at 9:21am

did you try using the [next] object?

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

#230017
Nov 18, 2012 at 9:57am

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…

#230018
Nov 18, 2012 at 10:31am

And there’s a Debounce example sketch too

#230019
Nov 18, 2012 at 10:33am

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

#230020
Nov 18, 2012 at 11:56am

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?

#230021
Nov 18, 2012 at 12:06pm

…found it

#230022

You must be logged in to reply to this topic.