Pages: [1]   Go Down
Author Topic: Print...  (Read 332 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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);
  }
}
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That sketch works for me.

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

USA, FL
Offline Offline
God Member
*****
Karma: 14
Posts: 688
A life? Where can I download one of those?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Serial.println("");

so it will print to a new line everytime.
« Last Edit: November 22, 2012, 10:38:34 pm by codlink » Logged

//LiNK

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Switched to a different computer and now it works fine.
Logged

Pages: [1]   Go Up
Jump to: