Using Servo.h gives crap Serial.print()

Hi there;

I'm trying to get the example of the servo library working, and it does....

But I'm getting some crap readings on the serial monitor: instead of "ready" I get "A??" and others I do not have on my keyboard.

Is there a bug in servo.h that induces it ?

Tried changing serial speed, but orders are received correctly by Arduino, so it works one way ?

Hi Jay, you don't say if the serial monitor works without the servo code. Have you tried to run the sketch with all the servo code removed to verify if that is affecting the problem.

If the problem goes away, you will need to tell us which servo library you are using. If the problem persists, try disconnecting the servo(s) to see if they are drawing too much power for your board.

Actually, try disconnecting the servos first and see if that fixes it.

Good luck

Ok, just did the trouble shooting you told me (I should have taught about it my self :-[ )

And it’s coming from pinMode(1,OUTPUT);

It’s an example taken from the playground and quite simple.
But it’s doing something …

Any Idea ?

BTW, this pinMode declaration is useless no ?

#include <Servo.h>

Servo servo1; Servo servo2; 


void setup() {

  pinMode(1,OUTPUT);
  servo1.attach(14); //analog pin 0
  //servo1.setMaximumPulse(2000);
  //servo1.setMinimumPulse(700);

  servo2.attach(15); //analog pin 1
  Serial.begin(19200);
  Serial.println("Ready");

}

void loop() {

  static int v = 0;

  if ( Serial.available()) {
    char ch = Serial.read();

    switch(ch) {
      case '0'...'9':
        v = v * 10 + ch - '0';
        break;
      case 's':
        servo1.write(v);
        v = 0;
        break;
      case 'w':
        servo2.write(v);
        v = 0;
        break;
      case 'd':
        servo2.detach();
        break;
      case 'a':
        servo2.attach(15);
        break;
    }
  }

  Servo::refresh();

}

Pin 1 is the serial output pin. That line should be commented out, it is not doing any good in yr sketch

Thank’s a lot !

So why is it in the example ?

(old software version maybe ?)

no idea why it was put there. I have just edited the playground to remove that line from the example.

Tnx man !

[smiley=thumbsup.gif]