I am trying to build a robot that uses 2 stepper motors (4-wires) with a l298n motor driver each and powered by an arduino mega 2560. I am using a FlySky FS-T4B RC Transmitter (4 channels) with a FS-R6B Receiver. My goal is to have the steppers spin continuous rotations with the RC Transmitter changing the speed of the motors. I am using the AccelStepper library to adjust the speed of the motors.
The Problem:
Every time a new signal comes in (which is constantly), the motors try to adjust, but just stutter step through the continuous rotations. This occurs with the pulseIn function. I know I should use interrupts, but I am more of a builder than a programmer, and I can't seem to incorporate interrupts with the stepper motor program. Could someone try to help me with this?
Pinout:
RC Receiver:
Channel 1 (Right Stick Horizontal) -> Mega Digital pin 53 (1010 - 1890) (Low and High values of each stick with the centered position at 1500)
Channel 2 (Right Stick Vertical) -> Mega Digital pin 52 (1080 - 1930)
Channel 3 (Left Stick Vertical) -> Mega Digital pin 51 (1140 - 1830)
Channel 4 (Left Stick Horizontal) -> Mega Digital pin 50 (1050 - 1940)
Stepper1 -> (2,3,4,5)
Stepper2 -> (10,11,12,13)
You probably won't need my program because I am basing this off of the MultiStepper example of the AccelStepper library with the modified pinouts.
Thank you for anyone who might be able to help me with this project.