[PD] add or subtract value every N ms?
padawan12 at obiwannabe.co.uk
Fri Jul 27 13:28:00 CEST 2007
A counter driven by a metro with a period N ms has its increment value
set to -1, 0 or 1 by messages. Don't forget you need the 0 to halt it.
Limits are set by min and max.
This implementatiion has a small bug. When you change direction the last
value stored in the float is flushed through so it overshoots by 1 in either
direction. But it's simple to understand.
On Thu, 26 Jul 2007 23:45:20 +0100
PROTMAN <protman.makes.music at gmail.com> wrote:
> Using a joystick pad to send a +1 or -1; when the value changes to +1, I
> want to increment a value every N ms, and when it is -1, I want it to
> subtract from the value every N ms.
> This will, in effect, cause the value to slide, at speed of N, between 0
> and 127. I would also need to have these values limited so they do not slide
> lower than zero or above 127.
> any hints on how to implement this?
> joe j hahn
> joehahn at gmail.com
> 773.818.2762 cell
> "All is fair in lunch and robot wars." ~___ _____
Use the source
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 783 bytes
Desc: not available
More information about the Pd-list