[PD] add or subtract value every N ms?
Andy Farnell
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?
>
> thanks!!
> jjh
>
> --
> 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...
Name: inc-dec-1.pd
Type: application/octet-stream
Size: 783 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070727/45b551f6/attachment.obj>
More information about the Pd-list
mailing list