Hi,
I bought an Arduino Uno, a 2H Microstep driver(Makeblock) and a stepper motor.
I already pluged it all together. I ran a simple program just to check that everything was working. And it worked!
Now, I'm trying to write a program that could run the motor in both direction with a specific speed. I also want the motor to be started with two pushbuttons. One for forward. and an other for reverse. I have difficulties finding codes that could do all that with this setup (Arduino + Makeblock).
Could you help me ?
I already have this program. Could you help me with the modification ? Thank you very much!! :
Code:
#define Pulse 9
#define Dir 8
long delay_Micros =1800; // Set value
long currentMicros = 0; long previousMicros = 0;
void setup()
{
pinMode(Pulse,OUTPUT);
pinMode(Dir,OUTPUT);
digitalWrite(Dir,LOW);
}
void loop()
{
currentMicros = micros();
if(currentMicros - previousMicros >= delay_Micros)
{
previousMicros = currentMicros;
digitalWrite(Pulse,HIGH);
delayMicroseconds(500); //Set Value
digitalWrite(Pulse,LOW);
} }