A basic problem with the program is that a single motor is being
controlled by two different threads. Threads should do different
things. For example you might have threads that play music, operate
an arm, and operate drive motors simultaneously. Two NXT threads
should not control the same sensor, motor, or output, however.
Cooperative concurrency (where threads share resources) is the
hardest part of parallel programming, and Mindstorms NXT really
isn't suitable for this degree of complexity.
Here's a good tutorial on using threads for anyone who's interested:
On 10/23/12 9:11 PM, Bob and Ann
[log in to unmask]"
Here is a
simple program where the robot moves, stops on a line,
executes a 2 motor 90 degree spin, and moves forward. At the
end, it suddenly lurches to the right, despite the stop
looking at it!
Ralph F Grove, Ph.D.
James Madison University Department of Computer Science
To UNSUBSCRIBE or CHANGE your settings, please visit
https://listserv.jmu.edu/archives/vadcfll-l.html and select "Join or leave the list".
VADCFLL administrative announcements are sent via VADCFLL-ANNOUNCEMENTS-L. Visit https://listserv.jmu.edu/archives/vadcfll-announcements-l.html to subscribe.