[solved] Servo Motor causing inability to connect to board

I am attempting to build a circuit that turns a servo motor when a temperature sensor detects that the temp has risen above a certain threshold. I am able to upload code to my board when the servo is unplugged, but when I plug it back in, I am no longer able to upload the code or view the serial monitor in my program.

Here is the error message:

avrdude: ser_open(): can't open device "\\.\COM3": The system cannot find the file specified.


Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

[Solved] I realized that by simply flipping over all of the wiring to the opposite side of the breadboard, the problem was fixed. I have no clue why this made a difference, but it did.

Please post your complete code in code tags </>.
And the complete compiler text using the quote tags (use the speech bubble in the icons in the editor).

Weedpharma

weedpharma:
Please post your complete code in code tags </>.
And the complete compiler text using the quote tags (use the speech bubble in the icons in the editor).

Weedpharma

Here is my code:

#include <Servo.h>

void setup() 
{
  Serial.begin(9600);
  pinMode(A0, INPUT);
  pinMode(13,OUTPUT);

}

void loop() 
{
  int temp = analogRead(A0);
  
  //convert temp to degrees farenheit 
  
  Serial.println(temp);

  Servo servo1;
  servo1.attach(13);
  
  if(temp > 80)
  {
    //tell motor to move 180 degrees and then move back
    servo1.write(180);
    delay(3000);
  }
  else
  {
    servo1.write(0);
    delay(3000);
  }
}

Here is the error message when the servo is plugged in:

Arduino: 1.6.8 Hourly Build 2015/12/23 04:43 (Windows 10), Board: “Arduino/Genuino Uno”

Sketch uses 4,160 bytes (12%) of program storage space. Maximum is 32,256 bytes.
Global variables use 242 bytes (11%) of dynamic memory, leaving 1,806 bytes for local variables. Maximum is 2,048 bytes.
avrdude: ser_open(): can’t open device “\.\COM3”: The system cannot find the file specified.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.

[solved]
see above post