SOLVED: Using sound sensor and light sensor at the same time
Posted: 11 Oct 2010, 18:43
Hi friends,
I am making a "racing robot" (standard driving base) which will be used at a charity event.
I use NXT-G to program.
My robot has a randomly generated number between 10 and 50 which represents the starting motor power. That's outside my loop. Then, inside a loop, because my robot "responds" to applause and cheering, the sound sensor generates a second number (decibel % as detected by the sound sensor) which is added to the randomly generated number and this value is passed to the motor block. Close loop. Everything's great, my robot surges ahead when its "jockey" is behind it clapping and cheering, and slows down when it's quiet. BUT... what I would like to do is add a Wait block so that when my robot crosses the (dark) finish line, it automatically stops (motor stop block).
I know how to do either the sound sensor in an endless loop as I've described, or the dark-line detection using the wait block, but how can I combine them? If I put the wait block and motor stop blocks inside the loop, my robot just starts up again... if I put it outside the block it will never get there... I have tried doing a parallel beam and even that doesn't work.
I tried to attach my .rbt files (one is my random number speed plus stopping at black line, one is random number speed that gets upped by the noise level), but I can't attach .rbt... I'll check the FAQ and repost with attachments if I can.
Thanks for the help!
Nunzilla
the NXT nun
I am making a "racing robot" (standard driving base) which will be used at a charity event.
I use NXT-G to program.
My robot has a randomly generated number between 10 and 50 which represents the starting motor power. That's outside my loop. Then, inside a loop, because my robot "responds" to applause and cheering, the sound sensor generates a second number (decibel % as detected by the sound sensor) which is added to the randomly generated number and this value is passed to the motor block. Close loop. Everything's great, my robot surges ahead when its "jockey" is behind it clapping and cheering, and slows down when it's quiet. BUT... what I would like to do is add a Wait block so that when my robot crosses the (dark) finish line, it automatically stops (motor stop block).
I know how to do either the sound sensor in an endless loop as I've described, or the dark-line detection using the wait block, but how can I combine them? If I put the wait block and motor stop blocks inside the loop, my robot just starts up again... if I put it outside the block it will never get there... I have tried doing a parallel beam and even that doesn't work.
I tried to attach my .rbt files (one is my random number speed plus stopping at black line, one is random number speed that gets upped by the noise level), but I can't attach .rbt... I'll check the FAQ and repost with attachments if I can.
Thanks for the help!
Nunzilla
the NXT nun