Hey all,
I'm stuck.
I have a sensor which is spitting out numbers between 1-180.
Each number triggers an event that I only want to happen once but the sensor repeats numbers every so often.
What I require is to have my numbers in 'something', so that if that number has already been used I want Pd to say - 'hey' and then allow me to change that number until we find one that hasn't been used?
I have spent the last couple of hours working with my numbers in a message box and using [list-delete]. I think it must be my usage because it's behaving very erratically (patch attached). If someone could tell me what I'm doing wrong with this and then maybe I/we can get onto the main problem
been used and spit it back at me so I can do some maths stuff to change to a different number that hasn't been used already.
Best wishes,
Julian
W7 PDE (latest)
J bz wrote:
I have a sensor which is spitting out numbers between 1-180.
Each number triggers an event that I only want to happen once but the sensor repeats numbers every so often.
You can use a table of 180 elements, each of which is initialized with zeros. When a sensor number occurs, check against the table. If it's 0, turn it to 1 and go on. If it's 1, do nothing and wait for a fresh number from the sensor. Or, if you don't want to wait, scan the table for the first zero. What appends when there's no zeros left is up to you.
(patch attached)
You did not sew it solid enough it seems:).
Hey Charlot,
Yes, that seems a good approach.
Will try in a few hours with a bit more time.
"You did not sew it solid enough it seems:)."
Definitely dropped a few stitches with this one:) I try to re-attach.
(btw - what is up with gmail and attachments atm?)
All good wishes,
Julian
On 27 March 2011 02:07, Charles Goyard cg@fsck.fr wrote:
J bz wrote:
I have a sensor which is spitting out numbers between 1-180.
Each number triggers an event that I only want to happen once but the
sensor
repeats numbers every so often.
You can use a table of 180 elements, each of which is initialized with zeros. When a sensor number occurs, check against the table. If it's 0, turn it to 1 and go on. If it's 1, do nothing and wait for a fresh number from the sensor. Or, if you don't want to wait, scan the table for the first zero. What appends when there's no zeros left is up to you.
(patch attached)
You did not sew it solid enough it seems:).
-- Charlot
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list