2025-01-08 18:38:46 -06:00
|
|
|
// ConstantSpeed.pde
|
|
|
|
// -*- mode: C++ -*-
|
|
|
|
//
|
|
|
|
// Shows how to run AccelStepper in the simplest,
|
|
|
|
// fixed speed mode with no accelerations
|
2025-01-08 18:39:37 -06:00
|
|
|
// \author Mike McCauley (mikem@airspayce.com)
|
2025-01-08 18:38:46 -06:00
|
|
|
// Copyright (C) 2009 Mike McCauley
|
|
|
|
// $Id: ConstantSpeed.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $
|
|
|
|
|
|
|
|
#include <AccelStepper.h>
|
|
|
|
#include <Wire.h>
|
|
|
|
#define HALFSTEP 8
|
|
|
|
|
|
|
|
#define motorPin1 2 // IN1 on the ULN2003 driver 1
|
|
|
|
#define motorPin2 3 // IN2 on the ULN2003 driver 1
|
|
|
|
#define motorPin3 4 // IN3 on the ULN2003 driver 1
|
|
|
|
#define motorPin4 5 // IN4 on the ULN2003 driver 1
|
|
|
|
|
|
|
|
AccelStepper stepper(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
stepper.setMaxSpeed(1000);
|
|
|
|
stepper.setSpeed(127.7);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
stepper.runSpeed();
|
|
|
|
}
|