RC controlled Stepper Motors

Thank you for your responses.

jremington:
As you are discovering, stepper motors are a very poor choice for robot locomotion. They waste power and are very difficult to control with RC.

For the wheels, continuous rotation servos would be a much better choice.

Regarding this, I will say I am building a BB8 robot which would eventually need to be self-balancing and I found many successful examples of self-balancing robots using stepper motors. Additionally, the motors need to have a lot of torque in order to spin the ball as it has to spin a large support beam (diameter of like 11in which is basically the wheel in this case), which I believe stepper motors might have the advantage there (feel free to correct me if I am wrong, however, I have gone with stepper motors so there is nothing else that can be changed here). Stepper motors also are more precise for my needs.

No. We do need to see your code. Even if I knew which example you modified, I would need your modifications.

Post your code. Use code tags. And you are right, this is likely a timing issue. I do not like pulsein for RC receiver decoding.

Here is my code:

#include <AccelStepper.h>
#include <MultiStepper.h>

AccelStepper stepper1; // Defaults to Accelstepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
AccelStepper stepper2(AccelStepper::FULL4WIRE, 10, 11, 12, 13);


#define rcPin1 6   // Pin 8 Connected to CH1 of Transmitter;
#define rcPin2 7   // Pin 9 Connected to CH2
#define rcPin3 8   
#define rcPin4 9


int ch1 = 0;  // Receiver Channel 1 PPM value
int ch2 = 0;  // Receiver Channel 2 PPM value
int ch3 = 0;
int ch4 = 0;

int motorSpeed = 0;

void setup()
{  
    stepper1.setMaxSpeed(500.0);
    stepper2.setMaxSpeed(500.0);
    stepper1.setSpeed(motorSpeed);
    stepper2.setSpeed(motorSpeed);    
  pinMode(rcPin1, INPUT); // 4 channels are listed here, but only channel 3 is being used for now
  pinMode(rcPin2, INPUT);
  pinMode(rcPin3, INPUT);
  pinMode(rcPin4, INPUT);

  Serial.begin(9600);
}

void loop()
{
  ch1 = pulseIn(rcPin1, HIGH, 20000);  // (Pin, State, Timeout), Right Stick Horizontal
  ch2 = pulseIn(rcPin2, HIGH, 20000);  // Right Stick Vertical
  ch3 = pulseIn(rcPin3, HIGH, 20000);  // Left Stick Vertical
  ch4 = pulseIn(rcPin4, HIGH, 20000);  // Left Stick Horizontal
  Serial.println(ch3); 
    
      motorSpeed = map(ch3, 1080, 2000, 0, 500); //maps the receiver values to a range for the stepper motors
      stepper1.setSpeed(motorSpeed);
      stepper2.setSpeed(motorSpeed); 
      Serial.print("Stick Up, Speed: ");
      Serial.println(motorSpeed);
      stepper1.runSpeed(); //continuous rotations to run the mapped speed
      stepper2.runSpeed();
      delay(100);
      
  }