Help with Zoetrope

Please help me i cant seem to find where i did wrong

if (onOffSwitchState != previousOnOffSwitchState){

error: 'previousOnOffSwitchState' was not declared in this scope

const int controlPin1 = 2;
const int controlPin2 = 3;
const int enablePin = 9;
const int directionSwitchPin = 4;
const int onOffSwitchStateSwitchPin = 5;
const int potPin = A0;

int onOffSwitchState = 0;
int previousOnOffSwithState = 0;
int directionSwitchState = 0;
int previousDirectionSwithState = 0;

int motorEnabled = 0;
int motorSpeed = 0;
int motorDirection = 1;

void setup(){
  pinMode(directionSwitchPin, INPUT);
  pinMode(onOffSwitchStateSwitchPin, INPUT);
  pinMode(controlPin1, OUTPUT);
  pinMode(controlPin2, OUTPUT);
  pinMode(enablePin, OUTPUT);
  
  digitalWrite(enablePin, LOW);
}
void loop(){
  onOffSwitchState =
    digitalRead(onOffSwitchStateSwitchPin);
  delay(1);
  directionSwitchState =
    digitalRead(directionSwitchPin);
  motorSpeed = analogRead(potPin)/4;
  
if (onOffSwitchState != previousOnOffSwitchState){
    if(onOffSwitchState == HIGH){
      motorEnabled = !motorEnabled;
    }
  }
  
  if (directionSwitchState !=
  previousDirectionSwitchState) {
    if directionSwitchState == HIGH) {
      motorDirection = !motorDirection;
    }
  }
  
  if (motorDirection ==1) {
    digitalWrite(controlPin1, HIGH);
    digitalWrite(controlPin2, LOW);
  }
  
  else {
    digitalWrite(controlPin1, LOW);
    digitalWrite(controlPin2, HIGH);
  }
  
  if (motorEnabled == 1) {
    analogWrite(enablePin, motorSpeed);
  }
  else {
    analogWrite(enablePin, 0);
  }
  previousDirectionSwitchState =
    directionSwitchState;
  previousOnOffSwitchState = onOffSwitchState;
}

you wrote "int int previousDirectionSwithState = 0;" instead of "int previousDirectionSwit[u]c[/u]hState = 0;" spelling issue... 8) c is missing

Hi, can you tell us

1) What your sketch is trying to do? 2) What it is doing? 3) Post the complete sketch. 4) Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Seeing this as your first line did not help.

if (onOffSwitchState != previousOnOffSwitchState){[color=#222222][/color]
[color=#222222][/color]
error: 'previousOnOffSwitchState' was not declared in this scope

How much experience have you in programming and electronics.

We hope to help, but rely on you to give us all the information necessary to give you reliable solutions.

Tom........ :)

@Wicced, i think there's a couple of spelling mistakes you did especially the Switch part cause on 2 places you have Swith. it's supposed to be Switch with a c. :sunglasses: