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

is wrong, it has to be like this:
int potentiometer = A0;

This is not required because you can use the potentiometer with:
int value = analogRead(Potentiometer);
reads. the Arduino knows that it has to switch to analog input here.