3D Zoetrope power circuit


I am building a 3D zoetrope. The following code is for the the power control circuit, and basically consists of a few pin outs and some timers. (There is another circuit for the strobe) I have wired up the circuit with simple LED’s standing in for the real components, and can’t achieve the behavior that the code describes.

At rest, PIN 5 is high

When PIN 3 is pulled low, PIN 5 goes low, PIN 4 goes high.

After 15 seconds (WAIT_TIME) it returns to its resting state.

In other words, timer2 does not seem to be working, and / or the behavior of the circuit is not that which the code describes.

Please take a look at the code and let me know if you see anything I am missing.

Thank you,


/* tiny trinket latching power circuit
 * when button is pressed, turn motor on and send sig to leds-controller
 * and turn off system in 90 seconds + the amount of time we need to wait for motor spin-up
 * for subsequent button-presses while already running, restart the 90-second timer
 * *This firmware works ONLY in conjunction with "LEDboard-proTrinket5vUSB" firmware
 * modified feb 2016 to use 3v 8mhz 328p Arduino Pro Mini

#include <Bounce2.h>
#include "Timer.h"  

#define ZOE_PIN 5  // this goes to the zoetrope circuit
#define MOT_PIN 4 // this goes to the powerswitch tail
#define BUTTON_PIN 3 // 
// note as of feb 2016 the Pro Mini has one extra/unused connection to the 
// power-button assembly; it's pro trinket pin 10 connected to Pro Mini pin 6

// 4/17/2016 adding pin 6 as always-on LED signal for the arcade button
#define BUTTON_LED 6

//note 4/17/2016 altering WAIT_TIME TIME from 40000 to 15000 in anticipation of better motor controller performance

#define WAIT_TIME 15000 // in ms, time to wait before all off and back to standby

unsigned long int DURATION = 180000; // 120 secs (clock speed is 8MHz not 16MHz)
unsigned long int TESTD = 1000 * 5; // 5 sec
int ledState = LOW;
int motorState = LOW;
Bounce debouncer = Bounce();
Timer *timer1 = new Timer(DURATION + WAIT_TIME);
Timer *timer2 = new Timer(WAIT_TIME);

void setup() {

  // Setup the button with an internal pull-up :

  // After setting up the button, setup the Bounce instance :

  // Setup the LED
  pinMode(ZOE_PIN, OUTPUT);
  pinMode(MOT_PIN, OUTPUT);
  digitalWrite(ZOE_PIN, !ledState);
  digitalWrite(MOT_PIN, motorState);
//  timer2->setOnTimer(&turnStrobeOn);

void loop() {
  // Update the Bounce instance :

  // Call this if Bounce fell (transition from HIGH to LOW) :
  if ( debouncer.fell()) { // if button was pressed

    if (motorState == LOW) { //if motor not running, turn it on and start led timer
      motorState = HIGH;
      ledState = HIGH;
      timer2->Start(); // starts countdown till LEDs go HIGH also
    } else { // if already running, prolong time till both are turned off
// update all pins
  digitalWrite(ZOE_PIN, !ledState);
  digitalWrite(MOT_PIN, ledState);

void turnMotorAndLEDsOff() {
  ledState = LOW;
  motorState = LOW;

In other words, timer2 does not seem to be working

Where have you told the instance when to do whatever needs doing?

Aha, I was missing a function:

void turnStrobeOn() {
ledState = HIGH;
motorState = LOW;

I would like to thank you for your generosity and kindness. I really enjoyed my stay at your post, our wonderful conversations, spending time with you all and our outings.