Send Bang when when maximum value is reached.

Brantiko's icon

Hi!
As so often I need your help to solve a very banal problem:

A Stepper-Motor controller sends out the position eg. 856. If the motor stops and turns around in the other direction it goes 855,854 and so on..
I want MAX to BANG if the maximum is reached (here: 856).

How ca this be made easily?

Yours

Brantiko!

Chris Muir's icon

[select 856]

Brantiko's icon

Yes, but the numbers is just an example.
At least I need to trigger the counting peak which alters.

Chris Muir's icon

Ah, so you don't know what the maximum is, you just want to know when the direction changes?

[change -] and [change +] indicate direction. A little work will have to be done to capture the maximum number, as this reports after the direction has changed.

Brantiko's icon

Hi!
In this case, change bangs when the Number is smaller than the number recieved before. But I want just ONE bang after the maximum value is reached.

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

There's an off by one error on the high number, but this gives you the bangs:

Brantiko's icon

Thank you.. this seems to be what I need.

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

If you know the peak value you're looking for, you can use sel or >= or peak or past. If you're just looking at a stream of data coming in in real time and you don't know what value you're looking for, then you can only report that a peak has occurred after the peak has been reached, once the input value has started to decrease. This abstraction does that.