connection of servo to arduino uno with xbee

hello there,
i’m alya.i was trying to control a servo by arduino with 2 xbee…one xbee at pc to control the other xbee at the arduino.my problem is that, after i connect the servo to the arduino, my pc cant read the arduino.“USB DEVICE IS NOT RECOGNIZED” is appeared.can i know why it happen?this is my coding:

#include <Servo.h>
Servo servoMain; // Define our Servo

const int ledPin = 13; // the pin that the LED is attached to
int incomingByte; // a variable to read incoming serial data into

void setup() {
// initialize serial communication:
Serial.begin(9600);
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
servoMain.attach(10); // servo on digital pin 10
}

void loop() {
// see if there’s incoming serial data:
if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:
incomingByte = Serial.read();
// if it’s a capital H (ASCII 72), turn on the LED:
if (incomingByte == ‘H’) {
digitalWrite(ledPin, HIGH);
}
else if (incomingByte == ‘A’) {
servoMain.write(90); // Turn Servo back to center position (90 degrees)
}
else if (incomingByte == ‘B’) {
servoMain.write(60); // Turn Servo back to center position (60 degrees)
}
else if (incomingByte == ‘C’) {
servoMain.write(45); // Turn Servo to 45 degrees
}
else if (incomingByte == ‘D’) {
servoMain.write(30); // Turn Servo back to center position (90 degrees)
}

}
// if it’s an L (ASCII 76) turn off the LED:
if (incomingByte == ‘L’) {
digitalWrite(ledPin, LOW);
}
else if (incomingByte == ‘E’) {
servoMain.write(0); // Turn Servo to 0 degrees
}
}

i need your help since my final year project exhibition is around the corner. :slight_smile:

How are you powering the Arduino / Servo combination?

If the code is for exhibition, better sort out the comments ;)