Cut off power when not used
This commit is contained in:
@@ -72,6 +72,8 @@ struct motor bench_motor = {33, 35, 31, motorHigh, {2, 0, 4, 0}, false};
|
|||||||
int forward[4] = {HIGH, HIGH, HIGH, LOW};
|
int forward[4] = {HIGH, HIGH, HIGH, LOW};
|
||||||
// backward move
|
// backward move
|
||||||
int backward[4] = {LOW, HIGH, HIGH, LOW};
|
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
|
// move_motor is used to move motor forward or backward
|
||||||
// arg motor: motor to activate is passed a parameter
|
// 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);
|
// bench_motor.pups.home.state = digitalRead(bench_motor.pups.home.pin);
|
||||||
cmd.joystick_x.state = analogRead(cmd.joystick_x.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
|
// setup_motors assign all pin to output and input for motors
|
||||||
void setup_motors()
|
void setup_motors()
|
||||||
|
|||||||
Reference in New Issue
Block a user