Issues with connecting a slideswitch to change between automatic and manual mode for a fan

Make your code more readable by instead of doing, for example, something like this:

//Switch input pin
  pinMode(6, INPUT);

Do this:
pinMode(switchA, INPUT);

Then post the entire code