NXT-G - Simultaneous Action

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
dna1990
Posts: 1
Joined: 16 Jul 2011, 15:38

NXT-G - Simultaneous Action

Post 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.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXT-G - Simultaneous Action

Post 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.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: NXT-G - Simultaneous Action

Post 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.
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 2 guests