Aug 23, 2006

Programming Question...

I was playing around with the MOVE block and found something that I don't quite understand...

I've never actually placed a MOVE block by itself and configured it for UNLIMITED Duration. I did this today and when I ran the program, the motors spun for 1 Duration.

I put the MOVE block inside a LOOP block (set to FOREVER) and configured the MOVE block for UNLIMITED and it ran until I stopped it.

Okay, here's the question. Shouldn't a basic MOVE block configured to UNLIMITED Duration keep spinning the motor without the LOOP block? Can anyone else duplicate this or is it possibly just something with my brick/motor?

13 comments:

Steve said...

The motor will run until the program ends.

The program ends after the motor block is executed.

So, it will start the motor, and end the program. The motor may not even be running as far as you think. It may just be coasting.

msim said...

Ive played around with the Unlimited move block a bit, and I think it only runs until the program has ended.
Like if you began a program with a Unlimited move block, then you put a bunch of switches there, without a loop, it will run that unlimited until it has preformed everything.

Jim Kelly said...

Ah... got it. I guess that makes total sense... the program is done so the motor stops.

Duh... sometimes I can't the forest for the trees.

Jim

NXTGord said...

You will also get the same thing when you use a Motor block with degrees/rotations and you don't specify wait for completion.

Anonymous said...

I did the same test, my NXT. The innitial move block moved the motor 1.5 rotations by my reckoning. But as you said, when in a. unlimited loop, the motor spins until I turned off the program. Odd, I'd say, I've created a "My Block" for this functionality issue.

David Levy said...

Isn't this this opposite behavior from the RIS? I think I recall that program stack completion did not automaticaly result in a STOP.

So what of the STOP block in the 'complete' palette.

Brian Davis said...

The "Stop" block is a way to terminate program execution based on some test condition, and it specificly says it results in coasting the motors. It other words, it addresses how to stop the sequence, not the outputs.

--
Brian Davis

dave_w said...

Is anyone using John Hansen's NBC? This is so much better than NXT-G for people who enjoy programming languages. Also, I did some cursory tests and the executable generated is 1/10 the size of a NXT-G executable. Want to increase your program storage by a factor of 10? :)

David Levy said...

NXT-G is great fo 8-10 year olds. It's also sanctioned by the FLL.

I haven't tried NBC yet and would be interested in reading comparisons of it to some of the other text based languages including RobotC. I'm still waiting to see what the Lejos roadmap looks like.

-david

Anonymous said...

Have any of you made a program for the NXT that runs for an extended period of time? It seems that the NXT powers off after a few minutes even if its in the middle of running a program. This is annoying, especially if it ends halfway through a motion. Does anyone know a way to dissable the auto-shutdown so it could run for several hours instead of only about 5-10 minutes?

-Steven

Jim Kelly said...

You have to use the Keep Alive block.

jim

Anonymous said...

The unlimeted block just means that it doesn't count how many degress that it goes just for how long

Michele said...

In summary, once you execute an unlimited Motor or Move block, the motor(s) will keep running until either (a) you give the motor(s) a new command such a Stop or another Move block, or (b) the program ends.

Related Posts Plugin for WordPress, Blogger...