Lack of zoom with my Zoetrope (Project 10 Arduino Starter Kit)

Hi there,

First time poster, new Arduino learner.

I know there's a few posts about this project already and I've had a read and tried a few of the code solutions, but no banana. So hoping someone might be able to give my code/set up a quick troubleshoot to see if I'm just being a bit dense!

My circuit is attached and here's my code is below. I'm getting no movement at all when I push the buttons/twist the potentiometer. There's three different set ups in the photo as I wondered if it was the placement of my potentiometer that might be causing the problem.

Any thoughts would be massively appreciated. Thank you!

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 previousOnOffSwitchState = 0;
int directionSwitchState = 0;
int previousDirectionSwitchState = 0;

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

void setup() {
  // put your setup code here, to run once:
  pinMode(directionSwitchPin, INPUT);
  pinMode(onOffSwitchStateSwitchPin, INPUT);
  pinMode(controlPin1, OUTPUT);
  pinMode(controlPin2, OUTPUT);
  pinMode(enablePin, OUTPUT);

  digitalWrite(enablePin, LOW);
}

void loop() {
  // put your main code here, to run repeatedly:
  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 could try adding some serial prints, to check you're reading things correctly.

That will help eliminate some wiring issues.

Thanks so much for the reply - when you say add some serial prints do you mean add commands to get some outputs on my laptop? Would you have any recommendations for the type of information to get? Sorry if that's a daft question, still very much learning haha.

Yeah, part of the problem in the forum is that the people who can help you best don't have a clue what any of the projects are, because they've never bought a starter kit.

One simple thing you could do is use the IDE's auto-format tool (CTRL-T) and see if the code still looks like the code in the book.

Otherwise, put "Serial.begin (9600);" in setup (), and then dot some "Serial.print ("variable name"); Serial.print (variable name);" for the different variables around your code.

e.g.

int onOffSwitchState = digitalRead(onOffSwitchStateSwitchPin);
Serial.print ("onOffSwitchState = "); Serial.println (onOffSwitchState);

ameewilson:
Hi there,

First time poster, new Arduino learner.

I know there's a few posts about this project already and I've had a read and tried a few of the code solutions, but no banana. So hoping someone might be able to give my code/set up a quick troubleshoot to see if I'm just being a bit dense!

My circuit is attached and here's my code is below. I'm getting no movement at all when I push the buttons/twist the potentiometer. There's three different set ups in the photo as I wondered if it was the placement of my potentiometer that might be causing the problem.

Any thoughts would be massively appreciated. Thank you!

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 previousOnOffSwitchState = 0;
int directionSwitchState = 0;
int previousDirectionSwitchState = 0;

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

void setup() {
  // put your setup code here, to run once:
  pinMode(directionSwitchPin, INPUT);
  pinMode(onOffSwitchStateSwitchPin, INPUT);
  pinMode(controlPin1, OUTPUT);
  pinMode(controlPin2, OUTPUT);
  pinMode(enablePin, OUTPUT);

digitalWrite(enablePin, LOW);
}

void loop() {
  // put your main code here, to run repeatedly:
  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;
    }
  }
}










![PXL_20210202_233821931.jpg|864x1536](upload://xxesDo4xFolRiAm9y9LrasCX8l6.jpeg)

![PXL_20210202_233114854.jpg|864x1536](upload://qcSHR8xyU1RIdtrCGH0RcfVHfKv.jpeg)

![PXL_20210203_000326720_2.jpg|1227x864](upload://vna9DdjdEaaaggXNqYHgXp4GpQo.jpeg)

Thanks for the recommendations and detailed instructions. I like reductionism and new cultural trends. I recently read a few facts about professional theater productions Hedda Gabler Summary | FreebookSummary of the 20th century. It seems to me that technological solutions and the right software could solve this problem.

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