Arduino Uno stepper Motor control using arduinofirmata 2.2 plugin

Hello vvvvers.

I was wondering if anyone with a deeper insight in coding could help me see if what i was thinking is right:

Considering This:

  • include <Stepper.h>

const int stepsPerRevolution = 48; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on the motor shield
Stepper myStepper(stepsPerRevolution, 12,13);

// give the motor control pins names:
const int pwmA = 3;
const int pwmB = 11;
const int brakeA = 9;
const int brakeB = 8;
const int dirA = 12;
const int dirB = 13;

int x = 0;
void setup() {
Serial.begin(9600);
// set the PWM and brake pins so that the direction pins // can be used to control the motor:
pinMode(pwmA, OUTPUT);
pinMode(pwmB, OUTPUT);
pinMode(brakeA, OUTPUT);
pinMode(brakeB, OUTPUT);
digitalWrite(pwmA, HIGH);
digitalWrite(pwmB, HIGH);
digitalWrite(brakeA, LOW);
digitalWrite(brakeB, LOW);

// initialize the serial port:
Serial.begin(9600);
// set the motor speed (for multiple steps only):
myStepper.setSpeed(2);
}

void loop() {

myStepper.step(48);
myStepper.step(-48);

delay(2000);

}

Does this Patch seem right?

Tnx =)

Arduino Stepper.v4p (26.5 kB)

I see a flaud in my Setup. 12 and 13 should be set as OUTPUT - HIGH (1) for one direction or LOW(0) for opposite direction. 3 and 11 Should be set as PWM. But my next question is, for my stepper setup does 3 and 11 have to move the value simultaneously?

hy … i need some help … i got arduino mega + ramps 1.4 + a4988 … and i dont know how to make it work … can you please help me

facebook Alin C. Lepadatau