Motors turning at the same time

Hi, this is my first time on here since I am still really new to Arduino. I am trying to make a simple robot like a Roomba of some sort that will avoid things like walls or ledges and I have that part done and it works well but I cant seem to figure out how to make the motors turn at the same time when there is no obstacle. I am using cheap stepper library.

Here is my code:

#include <CheapStepper.h>
CheapStepper stepper (4,5,6,7);
CheapStepper stepper1 (9,10,11,12);
int pushButton = 3;

void setup() {
// put your setup code here, to run once:



void loop() {

int buttonState = digitalRead (pushButton);


if (digitalRead(3)==1 || digitalRead(0)==0){

//both motors
stepper1.moveDegreesCCW (200);
stepper.moveDegreesCCW (200);

//single motor
stepper.moveDegreesCCW (400);


// both motors
stepper.moveDegreesCW (40);
stepper1.moveDegreesCW (40);


Robot.ino (787 Bytes)

If you post your code as described in the how to use this forum sticky more members will see it.

Please read and follow the directions in the How to use this forum post.

I noticed you are setting the input pins to INPUT, and not INPUT_PULLUP. That would mean you us using some sort of pullup in your wiring of the switches. It would be useful to describe how the switches are connected.

What Arduino board are you using? On most Arduino boards pin 0 is the Serial RX pin. Not wise to use pin 0 for anything else.