Go Down

Topic: Print... (Read 429 times) previous topic - next topic

What am I doing wrong, I can't get it to print.
Serial Monitor is set to 9600
The servo is working fine. Just ticking away. I'm sure this is something simple. I've tried Arduino 1.0.1 and 1.0.2
using Leonardo

Code: [Select]
#include <Servo.h>

Servo myservo; 
int pos = 0;   

void setup()
{
  Serial.begin(9600);
  myservo.attach(9); 
}

void loop()
{
  for(pos = 90; pos < 120; pos += 1) 
  {                                 
    Serial.print(pos);
    myservo.write(pos);             
    delay(500);
  }
}

WizenedEE

That sketch works for me.

Try disconnecting your servo; it may be an electrical problem.

codlink

#2
Nov 23, 2012, 04:36 am Last Edit: Nov 23, 2012, 04:38 am by codlink Reason: 1
Yep just tried it with mine and works without a servo attached.  If it works without the servo, then you have to power the servo from another source.  Like 3 or 4 AAs or something.

It prints out the value of pos on one line.  I add a

Code: [Select]
Serial.println("");

so it will print to a new line everytime.
//LiNK

Nothing attached to the arduino, but USB now.  Same thing.  Serial monitor is blank.
This is supposed to print to the serial monitor correct?
Maybe I'll try on a different computer.

Switched to a different computer and now it works fine.

Go Up