I recently purchased an Arduino Uno R3 board with a Arduino Motor Shield Rev3 as well as a joystick breakout board. My aim is to use the thumb joystick to control the direction of the stepper motor on the X-axis, left to right as well as the speed. So far I’ve been looking for good tutorials on the net with regards to the subject but had no luck so far.
Attached to this article are two photos showing how I connected my joystick to the motor shield board as well as a closeup view of the specific joystick I bought. Here is a link to the joystick as well:
Below is some sample code I downloaded from the net which rotates the shaft from one direction to the other with a delay. How can I modify this code to work with my setup and control the motor via the joystick:
const int spr = 200; // motor steps per revolution
const int pwm_cha = 3;
const int pwm_chb = 11;
const int dir_cha = 12;
const int dir_chb = 13;
const int brake_cha = 9;
const int brake_chb = 8;
Stepper stepper(spr, dir_cha, dir_chb);
Any help would really be appreciated!