enter image description here

I'm trying do make simple program. Two motors, two touch sensors. Sensor one increases speed, sensor two decreases.

The whole program works very well but only with one sensor. When I put some logic that has "Wait for sensor two" brick it just fools around.

The algorithm is very simple:

  • Variable i - counts times sensors being pressed
  • Variable Znak (eng. sign) causes variable i to decrease if negative or increase if positive.
  • Motor speed is calculated by multiplying i by 10.

How can I solve this kind of problem?

1 Answer 1


I found an answer. I read in a book that I can't fork in a loop. But I can do up to 4 separate threads. So I did 3 threads:

  1. Running/changing motors speed based on a variable "i" which is changed in other threads.
  2. Waiting for a touch sensor A being bumped and increasing var "i".
  3. Waiting for a touch sensor B being bumped and decreasing var "i".

3 threads

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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