 #define MOTOR_SWITCH_RIGHT 1
 int motorSwitchDetected = 0;
 
+// Timer Trigger Switches
+
+#define PORT_TIMER_SWITCH 15 // D8 = GPIO15
 
 int counter = 0;
 float h; // humidity

    lcdStatus("Switch Right");
    publishDebug("Right Motor Switch Detected");
  }
  delay(1000);
  digitalWrite(BUILTIN_LED, LOW);
  state = IDLE;
}

// Initialise Timers

void initTimers() {
  // This timer is for taking temperature and humidity readings
  os_timer_setfn(&environmentTimer, environmentTimerFinished, NULL);
  os_timer_arm(&environmentTimer,10000, true);

  // This timer is for tilting the tray (by activating the motor)

  os_timer_setfn(&trayTiltTimer, trayTiltTimerFinished, NULL);
  os_timer_arm(&trayTiltTimer,30000, true);
}

void initSwitches() {
  // Configure the ports for reading the motor switches
  publishDebug("Configuring switch sensors");
  lcdStatus("Init switch sensors");
  // pinMode(PORT_MOTOR_SWITCH_LEFT, INPUT_PULLUP);
  // pinMode(PORT_MOTOR_SWITCH_RIGHT, INPUT_PULLUP);

  pinMode(PORT_MOTOR_SWITCH_LEFT, INPUT_PULLUP);
  pinMode(PORT_MOTOR_SWITCH_RIGHT, INPUT_PULLUP);

  // pinMode(PORT_TIMER_SWITCH, INPUT_PULLUP);
  pinMode(BUILTIN_LED, OUTPUT);
  attachInterrupt(PORT_MOTOR_SWITCH_LEFT, motorSwitchLeftActivated, HIGH);
  attachInterrupt(PORT_MOTOR_SWITCH_RIGHT, motorSwitchRightActivated, HIGH);
  // attachInterrupt(PORT_TIMER_SWITCH, timerSwitchActivated, FALLING);
  delay(1000);
}

