I feel like I'm missing a simpler way, but this one should do the trick (see attachment).

The delay amount determines the maximum time that can elapse between the bangs of the two sensors. If a single bang is received from one sensor and the other doesn't arrive within that time, the "orphan" bang will be forgotten.

Is it what you were looking for?


On 08/17/2010 03:51 PM, João de Brito Rocha Reis Vidigal wrote:
As it is coming from the arduino firmata, the only way I know is that
the signal inputs a bang.
So I'll have 2 bangs being hit with a delay between them. this delay
depends on the speed of the body crossing the sensors and its size!
calling them bang1 and bang2, if the order is bang1 then bang2 = coming
in, if it is bang2 then bang1 it means coming out.
the thing is I think I have to pair the hits to set an order and I just
don't know how to pair them and read it to then bang an "in" or an "out".




On 17 Aug 2010, at 14:29, Andrew Faraday wrote:

what form is this coming into pd in?

If it's a list (such as (door_crossing in) or (door_crossing out))

then you could parse it down with routes

e.g.
[route door_crossing] (removes the first item in the list, if it's
door_crossing)
|
[sel in out] (the first two inlets will be a bang if it's in or out
respectively)

Not sure how else you might be getting the data into pd

 From: [email protected] <mailto:[email protected]>
 Date: Tue, 17 Aug 2010 13:45:53 +0100
 To: [email protected] <mailto:[email protected]>
 Subject: [PD] Bang order entry

 Hi again.
 Here goes another problem!

 Ok. So I'm working with Arduino firmata here...
 To expose to problem in a simple way, I have 2 sensors that are
detecting a door crossing.
 The 2 detectors give an order to the door crossing: coming in or going
out.
 Now I just don't know how I can translate that to bang 2 different
[bang( depending on if someone's comming in or going out!

 Can you help me with that!?
 Thanks

 Joao Vidigal
 _______________________________________________
 [email protected] <mailto:[email protected]> mailing list
 UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list



_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->  
http://lists.puredata.info/listinfo/pd-list

#N canvas 362 126 620 608 10;
#X text 131 15 Here comes your signal;
#X text 132 30 Use these bangs to simulate it;
#X text 149 59 =====> coming in;
#X text 149 74 <===== going out;
#X obj 126 69 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 260 69 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 197 278 +;
#X obj 197 301 t f f;
#X obj 197 330 select 0;
#X obj 200 371 f;
#X obj 203 401 select -1 1;
#X obj 166 444 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 257 442 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X text 151 468 IN;
#X text 251 470 OUT;
#X msg 128 103 1;
#X msg 260 104 -1;
#X obj 238 288 clip -1 1;
#X obj 196 158 t f f b b;
#X obj 242 212 delay 1000;
#X msg 260 186 stop;
#X msg 237 242 0;
#X connect 4 0 15 0;
#X connect 5 0 16 0;
#X connect 6 0 7 0;
#X connect 7 0 8 0;
#X connect 7 1 17 0;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X connect 10 1 12 0;
#X connect 15 0 18 0;
#X connect 16 0 18 0;
#X connect 17 0 6 1;
#X connect 18 0 6 0;
#X connect 18 1 9 1;
#X connect 18 2 19 0;
#X connect 18 3 20 0;
#X connect 19 0 21 0;
#X connect 20 0 19 0;
#X connect 21 0 6 1;
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to