Only output 1 Bang

startec's icon

I have a homemade OSC controller that occasionally outputs the same value twice. I have buttons on my controller, and I am using a route object so that a bang in max is only triggered on the up press (o) of my triggers and not the down press (1). Still though, some times two bangs are triggered, which I guess is because of some fault wiring in my controller. Is there any sort of "debouncing" that works when the controller is only putting out 1s and 0s. bangbang isn't working for me here because the controller is only putting out 1s and 0s, right after each other. Thanks

Wetterberg's icon

...how about the change object?

startec's icon

Thank you for the suggestion. The reason the change will not work is the same reason the route does not work. My controller is sometimes rapidly putting out two messages instead of one. (i.e. it bangs twice very quickly instead of once) I want to prevent that by having the second bang ignored somehow...

mzed's icon

...how about the onebang object?

startec's icon

The problem I have with the onebang is that, because my controller puts out only on/off messages, it will not work.
When the switch is double triggered it "sometimes" sends out an on, than an off, than an on and off again. So the one bang couldn't selectively route things correctly for me.

Wetterberg's icon

see below

Wetterberg's icon

okay, that's important information that we didn't get the first time, hehe.

Please show us your patch along with like a [print] of your controller information.

It sounds like you need normal "debouncing", so it could be a straight up electrical problem with the controller, but we can't really tell without seeing the patch.

Christopher Dobrian's icon
Max Patch
Copy patch and select New From Clipboard in Max.

And if double-triggering is your problem, how about onebang combined with delay?

startec's icon

Ha!
There it is, I think that delay will work great. I sometime have problems coming up with creative solutions. Thank you @Christopher and @Wetterberg. Really appreciate it.

It very well could be an electrical problem, this is for an Arduino based controller and I think it is giving me double values.

woyteg's icon

ignore

woyteg's icon

I'm not a hundred percent sure but I think there is a debounce example coming with the arduino software. You might want to solve the problem at the source(or nearer to it).

startec's icon

Yes, there are several instances of debouncing techniques included with Arduino. Unfortunately I am using Firmata which would not make it easy to incorporate those.