Pages: [1]   Go Down
Author Topic: AccelStepper problem  (Read 873 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Full Member
***
Karma: 0
Posts: 115
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi

not sure if this should go in programming or general electronics... trying to get the AccelStepper library to work and just not making any headway. I have the hardware setup exactly as in the tutorial for MotorKnob from the stepper library (http://arduino.cc/it/Tutorial/MotorKnob) with the  SN754410NE H-Bridge chip to drive it. When I run the example stepper code on it - all works fine :(i have my stepper plugged in on pins 14,15,16,17)

Code:
#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 14, 15, 16, 17);

// the previous reading from the analog input
int previous = 0;

void setup()
{
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(30);
}

void loop()
{
  // get the sensor value
  int val = analogRead(0);

  // move a number of steps equal to the change in the
  // sensor reading
  stepper.step(val - previous);

  // remember the previous value of the sensor
  previous = val;
}

but when i try to run on the same setup the basic AccelStepper code :

Code:
// ConstantSpeed.pde
// -*- mode: C++ -*-
//
// Shows how to run AccelStepper in the simplest,
// fixed speed mode with no accelerations
/// \author  Mike McCauley (mikem@open.com.au)
// Copyright (C) 2009 Mike McCauley
// $Id: ConstantSpeed.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $

#include <AccelStepper.h>

AccelStepper stepper(14, 15, 16, 17);

void setup()

   stepper.setMaxSpeed(1000);
   stepper.setSpeed(50);
}

void loop()

   stepper.runSpeed();
}

I get nothing- the stepper just does not move at all. As far as I could tell from my research online I was under the impression that the code should work with the same schematic as for the stepper library and with that H-bridge. I know that the hardware does work and there is no fault there.. but something just doesn't add up.

Was wondering if anyone had much experience with the AccelStepper library and had any working examples?

thank you for your time..
Logged

Pages: [1]   Go Up
Jump to: