initial fork
This commit is contained in:
40
examples/AFMotor_ConstantSpeed/AFMotor_ConstantSpeed.pde
Normal file
40
examples/AFMotor_ConstantSpeed/AFMotor_ConstantSpeed.pde
Normal file
@ -0,0 +1,40 @@
|
||||
// AFMotor_ConstantSpeed.pde
|
||||
// -*- mode: C++ -*-
|
||||
//
|
||||
// Shows how to run AccelStepper in the simplest,
|
||||
// fixed speed mode with no accelerations
|
||||
// Requires the AFMotor library
|
||||
// (https://github.com/adafruit/Adafruit-Motor-Shield-library)
|
||||
// Caution, does not work with Adafruit Motor Shield V2
|
||||
// See https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library
|
||||
// for examples that work with Adafruit Motor Shield V2.
|
||||
|
||||
#include <AccelStepper.h>
|
||||
#include <AFMotor.h>
|
||||
|
||||
AF_Stepper motor1(200, 1);
|
||||
|
||||
|
||||
// you can change these to DOUBLE or INTERLEAVE or MICROSTEP!
|
||||
void forwardstep() {
|
||||
motor1.onestep(FORWARD, SINGLE);
|
||||
}
|
||||
void backwardstep() {
|
||||
motor1.onestep(BACKWARD, SINGLE);
|
||||
}
|
||||
|
||||
AccelStepper stepper(forwardstep, backwardstep); // use functions to step
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600); // set up Serial library at 9600 bps
|
||||
Serial.println("Stepper test!");
|
||||
|
||||
stepper.setMaxSpeed(50);
|
||||
stepper.setSpeed(50);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
stepper.runSpeed();
|
||||
}
|
Reference in New Issue
Block a user