Cut off power when not used

This commit is contained in:
2022-08-12 19:47:21 +02:00
parent 0d14c0b1ef
commit cd4a6462d4

View File

@@ -72,6 +72,8 @@ struct motor bench_motor = {33, 35, 31, motorHigh, {2, 0, 4, 0}, false};
int forward[4] = {HIGH, HIGH, HIGH, LOW};
// backward move
int backward[4] = {LOW, HIGH, HIGH, LOW};
// freeMotor
int freeMotor[4] = {LOW, LOW, LOW, LOW};
// move_motor is used to move motor forward or backward
// arg motor: motor to activate is passed a parameter
@@ -146,6 +148,7 @@ void move_using_joystick()
// bench_motor.pups.home.state = digitalRead(bench_motor.pups.home.pin);
cmd.joystick_x.state = analogRead(cmd.joystick_x.pin);
}
move_motor(bench_motor, freeMotor);
}
// setup_motors assign all pin to output and input for motors
void setup_motors()