Hey Guys,
I am sure there is a simple solution to this but I can't seem to find it. I was hoping you guys would be able to help.
I recently decided to change up the name of a library I had been creating now and for some reason now it can't find a library.
I keep getting the error:
In file included from servoLeg2D.cpp:1:
E:\Users\Davey\Hobby Robotics\arduino-1.0\libraries\Leg2D/Leg2D.h:6:19: error: Servo.h: No such file or directory
In file included from servoLeg2D.cpp:1:
E:\Users\Davey\Hobby Robotics\arduino-1.0\libraries\Leg2D/Leg2D.h:21: error: 'Servo' does not name a type
E:\Users\Davey\Hobby Robotics\arduino-1.0\libraries\Leg2D/Leg2D.h:22: error: 'Servo' does not name a type
The arduino code I am trying to compile is located at:
arduino-1.0\myPrograms\servoLeg2D
CODE:
#include <Leg2D.h>
Leg2D leg0;
void setup()
{
leg0.attachServo(1,2);
leg0.attachServo(2,3);
}void loop()
{
//leg0.setS1(0);
//leg0.setS2(0);
leg0.setEEPos(130,130);
delay(1000);}
The library files are located at:
arduino-1.0\libraries\Leg2D\Leg2D.h
arduino-1.0\libraries\Leg2D\Leg2D.cpp
arduino-1.0\libraries\Servo\Servo.h
arduino-1.0\libraries\Servo\Servo.cpp
Leg2D.cpp
#include <Servo.h>
#include <Arduino.h>int d2 = 58;
int d3 = 138;
int aSQRE = square(d2);
int bSQRE = square(d3);int s1LowerLimit = 0;
int s1UpperLimit = 130;
int s2LowerLimit = 0;
int s2UpperLimit = 180;Leg2D::Leg2D()
{
followingPath = false;
}int Leg2D::attachServo(int servo, int servoPin)
{
int lowerLimit = 540; // 0 degrees at 540 microsecs with 0 degs tollerance
int upperLimit = 2360; //180 degrees at 2360 microsecs with 0 degs tolleranceswitch(servo)
{
//case 0: servo0.attach(servoPin, lowerLimit, upperLimit);
case 1: servo1.attach(servoPin, lowerLimit, upperLimit);
case 2: servo2.attach(servoPin, lowerLimit, upperLimit);
default: return -1;
}
}void Leg2D::setS1(int inputS1)
{
if (inputS1 > s1UpperLimit) inputS1 = s1UpperLimit;
if (inputS1 < s1LowerLimit) inputS1 = s1LowerLimit;
s1 = inputS1;
servo1.write(180-s1);
}void Leg2D::setS2(int inputS2)
{
if (inputS2 > s2UpperLimit) inputS2 = s2UpperLimit;
if (inputS2 < s2LowerLimit) inputS2 = s2LowerLimit;
s2 = inputS2;
servo2.write(s2);
}void Leg2D::setEEPos(int y, int z)
{
double cSQRE = square(y) + square(z);
double cosC = (aSQRE + bSQRE - cSQRE)/(2d2d3);
double C = acos(cosC);double theta = atan2(y,z);
double c = sqrt(cSQRE);
double cosB = (cSQRE + aSQRE - bSQRE)/(2cd2);
double B = acos(cosB);theta = theta * (360/(2M_PI));
B = B * (360/(2M_PI));
C = C * (360/(2*3.14));int uncheckedS1 = round(theta + B);
int uncheckedS2 = round(C-90);// Need a safety check in here to check position is obtainabl
int s1 = uncheckedS1;
int s2 = uncheckedS2;/*
Serial.begin(9600);
Serial.println(theta);
Serial.println(B);
Serial.println(C);
Serial.println(s1);
Serial.println(s2);
Serial.println();
*/// Also deal with negative direction
setS1(s1);
setS2(s2);
}int Leg2D::followPath(int startY, int startZ, int endY, int endZ, int duration)
{
if(!followingPath)
{}
}
Does anyone know why it can't file the Servo library?