Go Down

Topic: Need simple help for a new Arduino user (stepper coding) (Read 1 time) previous topic - next topic

helpJAMES

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

ookid

#1
Aug 09, 2011, 04:52 am Last Edit: Aug 09, 2011, 04:56 am by ookid Reason: 1
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, link and modify the example code given at the end of the page. I hope that helps you :D

PaulS

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?
The art of getting good answers lies in asking good questions.

Go Up