simultaneous functions with LilyPad USB Plus

Hi,

I want to have 2 functions working at the same time. These two functions are triggered by different sensors (light sensor trigger LEDs lighting and an accelerometer trigger a buzzer).

I want both “working” at the same time. I tried several solutions but I always end up with the same output, either nothing works, either the delay from one function impact the second one.

Is it possible to have two functions running in parrallel? If yes, how can I make it?

Thank you for your help

If you want both to work, you can’t have one blocking (with either a delay() or a while loop that spins waiting for a signal) or the other one won’t be checked at that time. The best way is to use a state machine or some flags to keep track of whether a signal has been seen or not. Try posting your code (use CODE tags) and someone may have some suggestions.

/mike