NXT Program doesn't do what it's supposed to do Ok, so I have this automatic gearbox I have made and I have 2 motors and 2 touch sensors

I want Motor A to spin forever unless Motor B is turning

Motor B should turn around 15 degrees and then brake. The direction depends on what touch sensor is pushed. I created this piece of block code thing (personally don't like) but it looks like it should work but it doesn't.



Motor A spins forever and when B is activated, it spins forever too completely destroying the gearbox :(

Pseudo Code:

If Touch1 == Bumped Then
    Stop MotorB
    Rotate MotorA by 15 degrees
Else If Touch2 == Bumped Then
    Rotate MotorA by -15 degrees
    Stop MotorB
Else
    Rotate MotorB Forever

(I know this is horrrible pseudo code but you get the jist)


What am I doing wrong???
You just need to make the blocks match your pseudo code. The missing part is "Stop Motor B". Adding blocks to stop motor B will help.

Also, stop motor B needs to be before starting motor A, otherwise motor A will run while motor B is running.

If Touch1 == Bumped Then
    Stop MotorB
    Rotate MotorA by 15 degrees
Else If Touch2 == Bumped Then
    Stop MotorB
    Rotate MotorA by -15 degrees
Else
    Rotate MotorB Forever