Just got Sparkfun's QuadStep board and tried running the example code and it won't compile. Error reads "quadstep does not name a type." The folder is in the right place, and I didn't touch the code itself. Anyone else come across this? -M
Here's the link to the library download and the specs for the board: SparkFun Quadstepper Motor Driver Board - ROB-10507 - SparkFun Electronics
Path = arduino > library > quadstep > Examples > QuadStep > QuadStep.ino
Code is here:
/*
SparkFun Electronics 2011
Aaron Weiss, aaron at sparkfun dot com
Beer-ware License: You can do whatever you want with this sketch.
If we meet someday, you can buy me a beer.
QuadSetpper Example Sketch. For use with an Arduino Mega2560 and
a 1.8 degree bipolar stepper motor.
You must connect the STP pin for each motor as shown below.
For rest of the pins, you choose where they go.
Motor1 STP pin: mega pin 11
Motor2 STP pin: meag pin 5
Motor3 STP pin: meag pin 6
Motor4 STP pin: mega pin 46
Library Usage:
motor_pins(x,y,z,l,m,n)
x: motor channel number
y: enable pin assignment
z: direction pin assignment
l: MS1 pin assignment
m: MS2 pin assignment
n: MS3 pin assignment
motor_go(x,y,z,l)
x: motor channel number
y: step size: 1, 2, 4, 8, or 16
z: increments for given step size
for full step: 1 increment = 1.8deg
for half step: 1 increment = 0.9deg and so on
negaitve numbers rotate in the opposite direction
l: torque/speed (0-10), 0 is high speed/low torque/low current
10 is low speed/high torque/high current (2.0A max)
stall(x)
x: motor channel number
*/
// include the motor library
#include <quadstep.h>
// create an instance of the class motor
quadstep quadstep;
void setup() {
// assign the pin connections
quadstep.motor_pins(1,A1,36,A8,A9,A10); //ch 1
quadstep.motor_pins(2,10,9,8,7,4); //ch 2
quadstep.motor_pins(3,22,23,24,25,26); //ch 3
quadstep.motor_pins(4,27,28,29,30,31); //ch 4
}
//1.8deg = 1step
void loop() {
// step motor 4 for 200 increments CW
quadstep.motor_go(2,1,-200,2);
delay(500);
// step motor 4 for 200 increments CCW
quadstep.motor_go(2,1,200,2);
delay(500);
// holds the motor in one position with full torque/current
//motor.stall(4);
//delay(500);
}
Udpate: solved one problem, have new one. The prior error was due to running the code and its libraries from inside a Dropbox folder. That's a no-no. I moved everything into the Documents > Arduino > Libraries folder and compiled and get a new error: " Error Compiling: In file included from quad_step_test.cpp:43: /Users/matthewepler/Documents/Arduino/libraries/quadstep/quadstep.h:12:22: error: WProgram.h: No such file or directory"
Clues?
-M
Found the problem. In the .cpp and .h file included in the library, you need to change
#include "WProgram.h"
to ->
#include "Arduino.h"
This is if you're running 1.0.1. Not sure about other versions. This will also be true for any library written before this change in the Arduino software.
Thanks! All those same issues I experienced and fixed per the notes...however, i know get the following errors:
(note: had to change quadstep.cpp to quadstep.ino to use the arduino programmer....)
quadstep.ino: In constructor 'quadstep::quadstep()':
quadstep:20: error: 'PORTH' was not declared in this scope
Libraries use .h and .cpp, never .ino
PORTH is Mega-specific so perhaps you had the wrong board type selected.