|
In article <399BC928.FE3AB9BA@yahoo.com>, Zhengrong Zang
<legozang@yahoo.com> wrote:
>
> task check_touch()
> // Checks whether touch sensors are touched and takes action
> {
> while (true) {
> if (SENSOR_1 == 1) {
> stop check_light;
> if (touchnumb > 1) {
> // Stop everything else
> StopMotor
> PlaySound(SOUND_UP);
> Wait(9);
> stop check_touch;
> }
> else {
> // backup a bit and try from there
> touchnumb += 1;
> Backward(7, 100);
> Forward(7, 0);
> start check_light;
> }
> }
> }
> }
Zhengrong - I tried replying to your e-mail, but it bounced. I'll
reply here (since the answer may be of interest to others as well).
The issue was that the above code needed a Wait(9) in order for the
sound to be heard on the Scout, but the RCX didn't require a Wait.
I think the problem is that after playing the sound you stop the task
that requested the sound to be played. Sounds get queued up and
played asynchronously...this means that the sound will have just
started (perhaps only a millisecond of sound played) when the 'stop'
command is executed. I'm guessing that on the Scout the sound got
canceled out of the queue when the task ended, while in the RCX it did
not. I'm not sure why Wait(9) would fix this...that's not enough time
for the sound to finish. Perhaps though its enough time for the sound
to start playing (and thus be "committed").
When I get some time, I'll try verifying this more completely (including
RCX 2.0 firmware), but I doubt there will be a fix other than what you
did.
Dave
--
reply to: dbaum at enteract dot com
|
|
Message is in Reply To:
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|