Unable to find the servo library
hey guys,
i sure there simple solution can't seem find it. hoping guys able help.
i decided change name of library had been creating , reason can't find library.
i keep getting error:
the arduino code trying compile located at:
arduino-1.0\myprograms\servoleg2d
code:
the library files 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
does know why can't file servo library?
i sure there simple solution can't seem find it. hoping guys able help.
i decided change name of library had been creating , reason can't find library.
i keep getting error:
quote
in file included 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 servoleg2d.cpp:1:
e:\users\davey\hobby robotics\arduino-1.0\libraries\leg2d/leg2d.h:21: error: 'servo' not name type
e:\users\davey\hobby robotics\arduino-1.0\libraries\leg2d/leg2d.h:22: error: 'servo' not name type
the arduino code trying compile located at:
arduino-1.0\myprograms\servoleg2d
code:
quote
#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 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
quote
#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 @ 540 microsecs 0 degs tollerance
int upperlimit = 2360; //180 degrees @ 2360 microsecs 0 degs tollerance
switch(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)/(2*d2*d3);
double c = acos(cosc);
double theta = atan2(y,z);
double c = sqrt(csqre);
double cosb = (csqre + asqre - bsqre)/(2*c*d2);
double b = acos(cosb);
theta = theta * (360/(2*m_pi));
b = b * (360/(2*m_pi));
c = c * (360/(2*3.14));
int uncheckeds1 = round(theta + b);
int uncheckeds2 = round(c-90);
// need safety check in here check position 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();
*/
// deal negative direction
sets1(s1);
sets2(s2);
}
int leg2d::followpath(int starty, int startz, int endy, int endz, int duration)
{
if(!followingpath)
{
}
}
does know why can't file servo library?
maybe should try re-install libraries or/and write code on new sketch.
Arduino Forum > Using Arduino > Installation & Troubleshooting > Unable to find the servo library
arduino
Comments
Post a Comment