 /////////////////////////////////////////////
 
 
-#define SENSOR_1_PIN   13
-#define SENSOR_2_PIN   7
-#define BLENDER_PIN    12
-#define GREEN_LED_PIN  5
-#define RED_LED_PIN    4
-#define BUTTON_PIN     2
-
-//The DIP switches!
-#define SWITCH_1_PIN  11
-#define SWITCH_2_PIN  10
-#define SWITCH_3_PIN  9
-#define SWITCH_4_PIN  8
+//These are on the "analog" arduino ports
+#define BUTTON_PIN   A0 //Port C0
+#define BLENDER_PIN  A1 //Port C1
+#define SENSOR_1_PIN A2 //Port C2
+#define SENSOR_2_PIN A3 //Port C3
+
+//The LEDs
+#define RED_LED_PIN  A4 //Port C4
+#define GRN_LED_PIN  A5 //Port C5
+#define BLU_LED_PIN 2 //Port D2
+#define YLW_LED_PIN 3 //Port D3
+
+
+#define COOLDOWN_LED_PIN BLU_LED_PIN
+#define WARMUP_LED_PIN YLW_LED_PIN
+#define ARMED_LED_PIN RED_LED_PIN
+#define PAUSED_LED_PIN GRN_LED_PIN
+
+//The Decoder - 74HC238
+#define DECODER_LINE0 4 //Port D4
+#define DECODER_LINE1 5 //Port D5
+#define DECODER_LINE2 6 //Port D6
+#define DECODER_ENABLE 7 //Port D7
 
 
 //Note that the PIR sensor needs at least 40 seconds to start up. 

int safetyThen;
boolean wasHigh = false;

///SETUP//////////////////////////////////////////////////////////////////
void setup(void)
{

  pinMode(BLENDER_PIN, OUTPUT);
  pinMode(SENSOR_1_PIN, INPUT);  
  pinMode(SENSOR_2_PIN, INPUT);  
  pinMode(BUTTON_PIN, INPUT);
  pinMode(GREEN_LED_PIN, OUTPUT);
  pinMode(RED_LED_PIN, OUTPUT);
  
  pinMode(SWITCH_1_PIN, INPUT);
  pinMode(SWITCH_2_PIN, INPUT);
  pinMode(SWITCH_3_PIN, INPUT);
  pinMode(SWITCH_4_PIN, INPUT);

  digitalWrite(BLENDER_PIN, LOW);
  digitalWrite(GREEN_LED_PIN, LOW);
  digitalWrite(RED_LED_PIN, LOW);

  Serial.begin(9600);
  Serial.println("Starting CounterCat2...");
  if (USE_PIR2)
  {
    Serial.println("Using PIR2 as safety.");

    if (now > (timerStart + COOLDOWN_TIME_MS))
    {
      Serial.println("Done cooling down.");
      currentState = S_ARMED;  
    }
    break;

  case S_PAUSED:

   turnOffAllLEDs();
   digitalWrite(PAUSED_LED_PIN, HIGH);
   
    if (now > (timerStart + BUTTON_DEBOUNCE))
    {
      if (buttonPushed)
      {
        Serial.println("Unpaused!");
        currentState = S_ARMED;          
        turnOffAllLEDs();
      }
    }
    break;
