Pages: [1]   Go Down
Author Topic: Newb Here! Tons of questions  (Read 445 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First off, hello all, im new here.

All questions are on Ubuntu 8.10

1. Error Building libary "Stepper"

2. Will this code be correct to just make a servo move to test it?

Code:
// Sweep
// by BARRAGAN <HIS SITE HERE>

#include <Servo.h>

Servo myservo;  // create servo object to control a servo

int pos = 0;    // variable to store the servo position

void setup()
{
  myservo.attach(0);  // attaches the servo on pin 9 to the servo object
}

void loop()
{
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

Logged

Connecticut, US
Offline Offline
Edison Member
*
Karma: 2
Posts: 1036
Whatduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

(1) What IS the error you got when you tried to build the "Stepper" library?  How did you attempt to build the library?

(2) myservo.attach([glow]0[/glow]); // attaches the servo on pin [glow]9[/glow] to the servo objects

Attaching things to pin 0 will make it hard to use the serial port, and I think the default library only supports pins 9 and 10.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is my old code, I changed it to 9. Also I didn't do anything. I opened up the program for the first time, put the code in and attempted to add that servo code to my microcontroller and got the stepper error.
Logged

Pages: [1]   Go Up
Jump to: