Hey i have created a talking mirror which shouts compliments when you walk past.
I am using PING ultrasonic Range Finder to pick up the person. I have combined Arduino with flash and it all works and picks a random compliment to shout out. However when a person walks in range it will keep shouting compliments but i want it to wait a while for the next time it shouts a compliment how would i do this ?
Also how do you remove an event listener after it has shouted the compliment
Change the code so that it waits for the person to go away (or perhaps, just waits for a defined interval to pass) before shouting the next compliment.
Mark : yes we had a workshop on it at uni and they didn't show it connected to java just flash .
Peter : do you know what code i need to place into the arduino code, so that once it has picked up a number in range and sent it to flash to play the compliment it then wont send another reading for 10 seconds ? or would this code need to be written in flash ?
First.. Id like to know more about how you have the Arduino >> Flash communication set-up (I post a thread on it not too long ago on the way I did my example..)
What system? (PC)
What are you using as the 3rd party 'service' to pass Arduino code to your Flash movie/app?
Does Flash return any values back to Arduino?
Anyways.. Im pretty sure the code would need to be modified on the Arduino side..
since that is where the sensor is connected and is what triggers the Arduino to post to the flash app saying "play the audio clip"...
I would set a threshold value variable.. and start a timer each time the audio is triggered to play.... if this 'threshold' hasnt been reached yet and the sensor 'senses' another trigger... ignore it.
nikolaclarke:
Peter : do you know what code i need to place into the arduino code, so that once it has picked up a number in range and sent it to flash to play the compliment it then wont send another reading for 10 seconds ? or would this code need to be written in flash ?
It's simple enough to do, but since you haven't posted your code of course it's impossible for me to suggest how this change could be incorporated. The general approach would be to save the current time in a variable after each message, and ignore subsequent movement unless the interval since the previous message exceeds some threshold. This is very similar to the behaviour of the 'blink without delay' sketch which would give you a good idea of how this could be implemented.