2

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.

enter image description here

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???

  • Your text description does not match the picture or pseudo code - motor A and motor B are mixed up. You should fix that for future readers. Also, your pseudo code is not horrible, it is perfectly clear. – David Lechner Aug 22 '16 at 23:53
1

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

enter image description here

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.