[PD] in/out count
Frank Barknecht
fbar at footils.org
Fri Jun 5 19:08:06 CEST 2009
Hallo,
potax flan hat gesagt: // potax flan wrote:
> this is doing my head in but i guess it's not rocket science...
> trying to figure out a system to keep track of how many people are in a room
> at any given moment.
> already have 2 sensors doing the physical work and sending bangs to pd, but
> then i get stuck...
> ii have 2 bangs ? one for the left sensor, the other for the right, so that
> the left+right sequence means someone goes in and the right+left one means
> someone leaves the room.
> i was trying to make it as elegant and simple as possible instead of having
> a crazy gate/select contraption.
You need an accumulator which is a reversed counter: Instead of [f ]x[+ 1] you
do:
[+ ]x[f ]
And then instead of a bang as in a counter you send numbers in: Send a 1 for a
new visitor and a -1 for a leaving visitor:
[r visitor-comes]
| [r visitor-leaves]
| |
[1( [-1(
| /
| /
|/
[+ ]x[f ]
|
[s visitor-count]
Ciao
--
Frank
More information about the Pd-list
mailing list