'a' was declared in this scope

#include <Stepper.h>


/*
  Stepper Motor Control - one revolution

  This program drives a unipolar or bipolar stepper motor.
  The motor is attached to digital pins 8 - 11 of the Arduino.

  The motor should revolve one revolution in one direction, then
  one revolution in the other direction.


  Created 11 Mar. 2007
  Modified 30 Nov. 2009
  by Tom Igoe

*/

#include <Stepper.h>

const int stepsPerRevolution = 64;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

#define A 8
#define B 9
#define C 10
#define D 11

#define NUMBER_OF_STEPS_PER_REV 64

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
  // initialize the serial port:
  Serial.begin(9600);
  pinMode(A, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);
  pinMode(D, OUTPUT);
}

void write() {
  digitalWrite(A, a);
  digitalWrite(B, b);
  digitalWrite(C, c);
  digitalWrite(D, d);
}

void onestep() {
  write(1, 0, 0, 0);
  delay(5);
  write(1, 1, 0, 0);
  delay(5);
  write(0, 1, 0, 0);
  delay(5);
  write(0, 1, 1, 0);
  delay(5);
  write(0, 0, 1, 0);
  delay(5);
  write(0, 0, 1, 1);
  delay(5);
  write(0, 0, 0, 1);
  delay(5);
  write(1, 0, 0, 1);
  delay(5);
}

void loop() {
  int i;
  i = 0;
  while (i < NUMBER_OF_STEPS_PER_REV) {
    onestep();
    i++;
  }
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);

  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(500);
}

Where? Copy that line. I don't find it.

sorry, it was suppose to be " 'a' as not declared in this scope"

The compiler does not lie

Why are you passing 4 values to a function that is declared as requiring no arguments ?

tryin to combine codes to et a step count for a turntable

Can you explain what this is supposed to do?

 write(1, 0, 0, 0);`

a is undefined and so is b, c and d, did you copy paste the code from elsewhere?

Would make sense. Anatomy of a function.

ok, so I was tryin to figure out how many steps my stepper motor as to take to turn my turntable 1 revolution. I was able to figure out another way.

I am attempting to build the cellphone 3d scanner found in thingiverse, its original design called for a standard servo modified for continuous rotation, which is not possible. So I modified the design to use a stepper motor. I was finally able to determine that my it takes 12 complete revolutions of my motor to complete one revolution of the scanning turntable.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.