Pages: [1]   Go Down
Author Topic: Librairies in librairies  (Read 172 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone.

I'm trying to make my own servo library using the Servo.h library. So I created a  Servo_me.h in a libraries folder in sketchbook. Here is my code (it's really an easy code. The class Motor is another class that I've made in order to control motor through a H-bridge.

Code:
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#include <pins_arduino.h>
#endif

#ifndef _SER_H
#define _SER_H
#include <Servo.h>
#include "Motor.h"

#define DEVICE (0x53)

class Servo_me : public Motor{
protected :
int pin;
Servo ser;
public :
Servo_me(int p1, int p2, int pin) : Motor(p1, p2), pin(pin){ser.attach(pin);};
Servo_me(int p1, int p2, int pin, int min, int max) : Motor(p1, p2), pin(pin){ser.attach(pin,min,max);};
void write(int deplacement){this->write(deplacement);}
};

#endif

The thing is I get this error :
In file included from Walking.ino:1:0:
/home/Malcolm/sketchbook/libraries/Motor/Servo_me.h:10:23: fatal error: Servo.h: No such file or directory
compilation terminated.

And I don't know why the IDE is not able to find Servo.h since I #include it...

Any idea ? =/
Logged

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You have to include the Servo.h in the main sketch as well.  Without that the IDE doesn't know to go and look for it.
Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK thanks.

I'll try it later today =)
Logged

Pages: [1]   Go Up
Jump to: