Serial.print and Servo's

I’m simply trying to print the servo’s POT position to the monitor, but when I add Serial.print to the code… the servo (motor) stops working?!

The code is straight from the MegaServo download…

#include <MegaServo.h>
#define NBR_SERVOS 1  // the number of servos, up to 48 for Mega, 12 for other boards
#define FIRST_SERVO_PIN 0 

MegaServo Servos[NBR_SERVOS] ; // max servos is 48 for mega, 12 for other boards

int pos = 0;      // variable to store the servo position 
int potPin = 0;   // connect a pot to this pin.

void setup()
  // Serial.begin(19200);
  for( int i =0; i < NBR_SERVOS; i++)
    Servos[i].attach( FIRST_SERVO_PIN +i, 800, 2200);
  // Serial.print("setup complete");
void loop()
  pos = analogRead(potPin);   // read a value from 0 to 1023

  for( int i =0; i <NBR_SERVOS; i++) {
   // Serial.print(i);
    Servos[i].write( map(pos, 0,1023,0,180));   
  delay(15);   }


Uncommenting the Serial.begin kills the servo. Using either 9600 or 19200…

Thanks for any help!



Right there.
Move the servo to a pin that isn’t being used to perform serial communication, and all should be fine.

many thanks!