I'm working on a project where using a gear motor with an encoder and an Arduino Uno. I have not done Arduino in a long time and am struggling getting it to do what I want. If you look at the wiring guide for the motor below here is what I have currently wired up:
1 - M1 (-) wired to the ground of the voltage source, 2-GND Encoder wired to the GND pin on the Arduino, 3-Encoder A phase wired to Pin9, 4-Encoder B phase wired to Pin10, 5-3V3 Encoder + wired to 3V3 pin on the Arduino, 6-M1 motor (+) wired to the hot voltage source.
When I supply a voltage source the motor begins to spin. I want the motor to start not moving even when the power is supplied. Then I want to be able to set the angle that the position of the motor will turn to that spot and have it stop moving. I will then turn off the power supply and the motor will stay in that position until power is supplied again a new position is programed into the code. This motor can rotate in both directions. Please help even suggestions what commands to use will be great.