You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
667 B
29 lines
667 B
7 years ago
|
// Blocking.pde
|
||
|
// -*- mode: C++ -*-
|
||
|
//
|
||
|
// Shows how to use the blocking call runToNewPosition
|
||
|
// Which sets a new target position and then waits until the stepper has
|
||
|
// achieved it.
|
||
|
//
|
||
|
// Copyright (C) 2009 Mike McCauley
|
||
|
// $Id: HRFMessage.h,v 1.1 2009/08/15 05:32:58 mikem Exp mikem $
|
||
|
|
||
|
#include <AccelStepper.h>
|
||
|
|
||
|
// Define a stepper and the pins it will use
|
||
|
AccelStepper stepper; // Defaults to 4 pins on 2, 3, 4, 5
|
||
|
|
||
|
void setup()
|
||
|
{
|
||
|
stepper.setMaxSpeed(200.0);
|
||
|
stepper.setAcceleration(100.0);
|
||
|
}
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
stepper.runToNewPosition(0);
|
||
|
stepper.runToNewPosition(500);
|
||
|
stepper.runToNewPosition(100);
|
||
|
stepper.runToNewPosition(120);
|
||
|
}
|