From cd4a6462d4b65e7601181cf1287aea3f7397a5bc Mon Sep 17 00:00:00 2001 From: Corwin Date: Fri, 12 Aug 2022 19:47:21 +0200 Subject: [PATCH] Cut off power when not used --- bench_motor.ino | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bench_motor.ino b/bench_motor.ino index ae6f316..bd530fd 100644 --- a/bench_motor.ino +++ b/bench_motor.ino @@ -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()