Skip to main content
2 of 2
lineize state list

If button is pressed: Motor A and B move for 1 second at slow speed == > Motor A keep moving but at fast speed and motor B stop. else: Motor A and B both stop.

I would do a quick state machine:

STATE / button released: do nothing;
STATE / button pressed: run motors a+b;
STATE / run motor a+b: run motor a+b; if 1 second has passed, advance to just run motor a;
STATE / run motor a: run motor a at fast speed and stop motor b.

fairly easy to code as well.

dannyf
  • 2.8k
  • 11
  • 13