Stepper Shield Example program doesn't compile

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Stepper Shield Example program doesn't compile

Postby pc_evans » Thu Oct 25, 2012 8:29 pm

I have an Arduino Duemilanove 168 connected to a Motor Shield kit V1.1 Product #81.

I also purchased your 12v 200 step motor. PID 324

Your motor came with the following colored wires and no labeling/key.

Green
Yellow
Red
Gray

Which wire goes where on my shield?

Your sample sketch does not compile.

[Edit - moderator - please use the 'code' button when posting code]
Code: Select all
// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>

// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #2 (M3 and M4)
AF_Stepper motor(200, 2);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Stepper test!");

  motor.setSpeed(10);  // 10 rpm   
}

void loop() {
  Serial.println("Single coil steps");
  motor.step(100, FORWARD, SINGLE);
  motor.step(100, BACKWARD, SINGLE);

  Serial.println("Double coil steps");
  motor.step(100, FORWARD, DOUBLE);
  motor.step(100, BACKWARD, DOUBLE);

  Serial.println("Interleave coil steps");
  motor.step(100, FORWARD, INTERLEAVE);
  motor.step(100, BACKWARD, INTERLEAVE);

  Serial.println("Micrsostep steps");
  motor.step(100, FORWARD, MICROSTEP);
  motor.step(100, BACKWARD, MICROSTEP);
}



Below are the errors I get when I compile.

StepperTest.pde:-1: error: 'AF_Stepper' does not name a type
StepperTest.cpp: In function 'void setup()':
StepperTest.pde:-1: error: 'motor' was not declared in this scope
StepperTest.cpp: In function 'void loop()':
StepperTest.pde:-1: error: 'motor' was not declared in this scope
StepperTest.pde:-1: error: 'FORWARD' was not declared in this scope
StepperTest.pde:-1: error: 'SINGLE' was not declared in this scope
StepperTest.pde:-1: error: 'BACKWARD' was not declared in this scope
StepperTest.pde:-1: error: 'DOUBLE' was not declared in this scope
StepperTest.pde:-1: error: 'INTERLEAVE' was not declared in this scope
StepperTest.pde:-1: error: 'MICROSTEP' was not declared in this scope
Attachments
filesystem.png
filesystem.png (111.2 KiB) Viewed 506 times
pc_evans
 
Posts: 2
Joined: Thu Oct 25, 2012 8:00 pm

Re: Stepper Shield Example program doesn't compile

Postby adafruit_support_bill » Thu Oct 25, 2012 8:56 pm

Your motor came with the following colored wires and no labeling/key.

Wire details are on the product page: (some motors have a grey wire instead of brown)
To connect to our shield, put the wires in this order: Red, Yellow, skip ground, Green, Brown


As for the compilation problem:
StepperTest.pde:-1: error: 'AF_Stepper' does not name a type

This indicates that you have not installed the library in the correct location.
The library is available here: https://github.com/adafruit/Adafruit-Mo ... ld-library
Follow the instructions here: http://www.ladyada.net/library/arduino/libraries.html
User avatar
adafruit_support_bill
 
Posts: 16083
Joined: Sat Feb 07, 2009 9:11 am

Re: Stepper Shield Example program doesn't compile

Postby pc_evans » Fri Oct 26, 2012 11:29 am

Thanks,

I have it working now.
pc_evans
 
Posts: 2
Joined: Thu Oct 25, 2012 8:00 pm


Return to Other Arduino products from Adafruit

Who is online

Users browsing this forum: No registered users and 4 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [108]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
Android[6]
 
BeagleBone[24]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[34]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]