Connecting 3.3v directly to analog pin

I am wondering if it is possible to directly connect the 3.3v output to an analog pin on an Arduino Micro. My goal is to determine the position of a on-off-on switch by connecting the 3.3v to the main switch pin and then connecting the 2 switch pins to the analog pins on the Arduino.

Right now, I am trying the following code:

//Pin to read left turn signals
int leftTurnSignalPin = A1;
//Pin to read right turn signals
int rightTurnSignalPin = A2;

void setup()
{
    Serial.begin(9600);     // Debugging only
    Serial.println("setup");
}

void loop()
{
  int leftTurnSignalRead = analogRead(leftTurnSignalPin);
  int rightTurnSignalRead = analogRead(rightTurnSignalPin);
  
  Serial.print("leftTurnSignalRead: ");
  Serial.println(leftTurnSignalRead);
  
  Serial.print("rightTurnSignalRead: ");
  Serial.println(rightTurnSignalRead);
  
  delay(300);
}

And am getting the following output:

leftTurnSignalRead: 726 rightTurnSignalRead: 671 leftTurnSignalRead: 642 rightTurnSignalRead: 603 leftTurnSignalRead: 537 rightTurnSignalRead: 503 leftTurnSignalRead: 404 rightTurnSignalRead: 386 leftTurnSignalRead: 313 rightTurnSignalRead: 299 leftTurnSignalRead: 239 rightTurnSignalRead: 230 leftTurnSignalRead: 166 rightTurnSignalRead: 165 leftTurnSignalRead: 126 rightTurnSignalRead: 130 leftTurnSignalRead: 134

As you can see, the output varies wildly if the switch is in the off position. If I move it, then the position I move it to has a reading of 667-669. Is there a way to get less-garbage data from this? If I put my hand on the switch, the signal builds up (starting from 0) the whole way to 1000+ (which is odd since it is 3.3v and not 5.5) over about 2 seconds.

Floating pin Syndrome.

When a pin is not connected to anything, what do you expect it to read? Google "pull-up resistor".

Or pull down, depeding if you want 0 or 1023 when the 3.3V is not connected.

Ah, its no worries if it is a up or down resistor - I just needed to know which position the switch was in. Thanks, I googled pull up resistor and it worked like a charm. Super duper easy.

If the voltage is constant, and simply being switched on or off, why are you using analog pins to read the state of the switch? That's a digital pin function.