Page 1 of 1
NXT-G - Simultaneous Action
Posted: 16 Jul 2011, 15:41
by dna1990
Is there a way to turn on two different color lamps (different ports) at the same time?
Even using parallel beams, there is a delay between the main beam and the branch.
Re: NXT-G - Simultaneous Action
Posted: 16 Jul 2011, 16:48
by mattallen37
The NXT cann't do true multitasking. It only can do one thing at a time. The FW is setup to switch between tasks fairly quickly and easily. However, it takes quite a while for the color sensor to change color modes (I don't remember the exact numbers, but I think it's something like 150-200ms). Even running in multiple tasks, I don't think you can improve the overall time.
Edit: just a guess, but the FW code that runs the color sensor is likely shared among all sensor ports (can only be accessed one at a time). If this is the case, it would have to completely finish with one before sending commands to another.
Re: NXT-G - Simultaneous Action
Posted: 16 Jul 2011, 21:20
by muntoo
I'm assuming the "turn light on" code has a
wait
statement internally.
Try upgrading your brick to the NBC/NXC Enhanced Firmware - then the wait statement will simply rotate the task queue instead of freezing your code, and the other beam will run while the main beam continues to wait in the background.
You could also make a "turn light on" block of your own.