We are extending famous Dave Parker's nxtprograms.com 2 Touch Remote I have added 2 extra "threads" - one to control 3rd motor (which is a frontal "claw") and another one to use 4th touch sensor to reverse the robot. Please see screenshot enclosed. The issue we are experiencing is that the robot does not reverse when we press 4th touch sensor, although it does make sound. I am wondering if there's some kind of limitation - eg. you can't control same motors from different threads?Please see program screenshot


In the middle "thead" all of your motor blocks are "unlimited" or "stop". These blocks change the motor state and immediately continue to the next block. These are inside a loop that loops forever, so these blocks are running continuously in the loop. The motor blocks in the top thread may have an effect for a split second until the middle thread loops again and changes what the motor is doing.

I suggest writing to a variable in the top thread instead of using motor blocks. Then read from that variable in the middle thread. For example, you could use a numeric variable and give it a value of '1' for forwards and -1 for reverse. Then in the middle thread, use a multiply math block to multiply the desired motor speed by the variable to change the direction.

Or, for that matter, you could read the 4th touch sensor value in the middle thread and remove the top thread.

  • Thank you, will try the suggested approach and post update here. – Konstantin Dec 2 '15 at 21:34
  • wouldn't the motor blocks in the middle thread only "activate" when 1st touch sensor is pressed? Eg. middle thread kicks in when 1st button is pressed, and then checks if 2nd button is also pressed at the same time. But if the robot is stationary, the top thread should kick in when we press 4th touch sensor, shouldn't it? – Konstantin Dec 3 '15 at 0:41
  • No, the switch blocks just check the touch sensor state and continue with one branch or the other depending on the current state. You would have to add a wait block to only "activate" the middle thread when a touch sensor is pressed. – David Lechner Dec 3 '15 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.