Hi all
I hope somebody can help me with this. I tried compiling this code
#include "SoftwareServo.h"
SoftwareServo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup()
{
myservo.attach(2); // attaches the servo on pin 2 to the servo object
}
void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
SoftwareServo::refresh();
But i get the follwing errors:
sketch_feb14a.cpp.o: In function `setup':
/Arduino/sketch_feb14a.ino:10: undefined reference to `SoftwareServo::attach(int)'
sketch_feb14a.cpp.o: In function `loop':
/Arduino/sketch_feb14a.ino:17: undefined reference to `SoftwareServo::write(int)'
/Arduino/sketch_feb14a.ino:21: undefined reference to `SoftwareServo::refresh()'
sketch_feb14a.cpp.o: In function `__static_initialization_and_destruction_0':
/Arduino/sketch_feb14a.ino:20: undefined reference to `SoftwareServo::SoftwareServo()'
collect2: error: ld returned 1 exit status
In softwareservo.h I changed the wprogram.h to #include <Arduino.h>.
It should be noted that i did not have my arduino connected to the computer but only tried compiling it on the computer.
Any help would be appriciated.