Hello!
I built a basic circuit with Arduino and micro servo but when I uploaded this bare program:
Servo myServo;
void setup()
{
myServo.attach(9);
}
void loop()
{
myServo.write(130);
delay(500);
myServo.write(0);
delay(500);
}
a heap of compline errors appeared like this ones:
/Users/Standa/Documents/Arduino/libraries/Servo/Servo.cpp: In member function 'uint8_t Servo::attach(int)':
/Users/Standa/Documents/Arduino/libraries/Servo/Servo.cpp:28: error: 'digitalWrite' was not declared in this scope
/Users/Standa/Documents/Arduino/libraries/Servo/Servo.cpp:29: error: 'OUTPUT' was not declared in this scope
/Users/Standa/Documents/Arduino/libraries/Servo/Servo.cpp:29: error: 'pinMode' was not declared in this scope
/Users/Standa/Documents/Arduino/libraries/Servo/Servo.cpp: In member function 'void Servo::write(int)':
So I switched to SoftwareServo library, updated this line at the beginning of SoftwareServo.h #include <WProgram.h> to #include "Arduino.h" (it didn't work for me before, I use Arduino v1.0.5) and uploaded this simply code:
#include <SoftwareServo.h>
SoftwareServo myServo;
void setup()
{
myServo.attach(9);
}
void loop()
{
myServo.write(90);
SoftwareServo::refresh();
}
but NOTHING HAPPENED.
All pins are connected correctly and I tried all my 4 servos, even a different Arduino board and output pins as well as various values of myServo.write().
Do somebody know please what wrong should be it?
I also wonder why Servo library provided by Arduino itself does not work for me and what is an advantage of SoftwareServo library?
Thank you very much.