 boolean powerEnabled = false;
 int targetDirection = CLOCKWISE;
 int currentDirection = CLOCKWISE;
+int motorTicks = 0;
+unsigned long lastRpmDisplayTime = 0;
 
 void setup()
 { 

#include <Bounce.h>
#include <UserTimer.h>

const int CLOCKWISE = 1;
const int COUNTER_CLOCKWISE = 0;

#if defined(__AVR_ATmega328P__)

// Arduino Pins
const int speedInPin = A0;
const int rateOfSpeedChangeInPin = A1;
const int speedOutPin = 9;
const int onOffSwitchInPin = 7;
const int directionSwitchInPin = 6;
const int directionOutPin = 5;

#elif defined( __AVR_ATtinyX4__ )

// ATMEL ATTINY84 / arduino-tiny mapping
//

Bounce onOffSwitch = Bounce(onOffSwitchInPin, switchDebounceTime);
Bounce directionSwitch = Bounce(directionSwitchInPin, switchDebounceTime);

Adafruit_7segment rpmDisplay = Adafruit_7segment();

// State variables
int targetSpeed = 0;
int currentSpeed = 0;
