Arduino Forum

Topics => Robotics => Topic started by: helpJAMES on Aug 08, 2011, 10:39 pm

Title: Need simple help for a new Arduino user (stepper coding)
Post by: helpJAMES on Aug 08, 2011, 10:39 pm
hey I just want to make a stepper motor move.

I have this code.
#include <AFMotor.h>

AF_Stepper motor(48, 1);

void setup(10) {
  Serial.begin(9600);   
  motor.setSpeed(10); 
}

void loop(10) {
  motor.step(100, FORWARD10, SINGLE);
  motor.step(100, BACKWARD10, SINGLE);
}

and im getting this error message
sketch_aug03a:1: error: variable or field 'loop' declared void
sketch_aug03a:2: error: 'AF_Stepper' does not name a type
sketch_aug03a:4: error: variable or field 'setup' declared void
sketch_aug03a:9: error: variable or field 'loop' declared void

can anyone help?
I'm very new to this.

thank you for your time

james
Title: Re: Need simple help for a new Arduino user (stepper coding)
Post by: ookid on Aug 09, 2011, 04:52 am
I don't know too much about the stepper library but there shouldn't be numbers in the parenthesis after void setup and void loop. Read this,http://www.ladyada.net/make/mshield/use.html (http://www.ladyada.net/make/mshield/use.html), link and modify the example code given at the end of the page. I hope that helps you :D
Title: Re: Need simple help for a new Arduino user (stepper coding)
Post by: PaulS on Aug 09, 2011, 03:15 pm
Code: [Select]
#include <AFMotor.h>

AF_Stepper motor(48, 1);

void setup()
{
  Serial.begin(9600);   
  motor.setSpeed(10);
}

void loop()
{
  motor.step(100, FORWARD, SINGLE);
  motor.step(100, BACKWARD, SINGLE);
}


This compiles for me. Where did those extra 10s come from in your code?