Subject:
|
NXT-G: Structured Programming
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Sat, 21 Oct 2006 18:48:19 GMT
|
Viewed:
|
11633 times
|
| |
| |
A First Lego League team wants to use the NXT buttons thusly:
left - decrease program number
right - increase program number
enter - run mission program
at end of each mission program, return to main program selection loop.
They do something like this: (I'm expressing in code)
while true
{
if (left_button) prognum -= 1;
else if (right_button) progrnum += 1;
if (prognum = 0) prognum = 5;
if (prognum = 6) prognum = 1;
display prognum;
if (enter)
{
if (prognum = 1) myblock1;
if (prognum = 2) myblock2;
if (prognum = 3) myblock3;
if (prognum = 4) myblock4;
if (prognum = 5) myblock5;
}
}
At this point, it's really an ugly looking program. I'm sure they'll need to
myblock the increment/decrement of the prognum so they can test the range
effectively and play a note corresponding to the prognum. I'm sure the
"picture" would be prettier if they use myblacks all the way through the main
loop. So what looks initially like a structured program can now be called
event-driven object oriented programming.
Hurrah for myblocks!
|
|
Message has 1 Reply: | | Re: NXT-G: Structured Programming
|
| (...) Agreed. I've seen this approach being bounced around with some FLL teams, and it's really a nice solution to the limited memory issues some are having. Not only can they switch between programs rapidly, but this can potentially save a *lot* of (...) (18 years ago, 23-Oct-06, to lugnet.robotics.nxt)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in NXT programmable brick
|
|
|
|