Hi,
I'm using this led bargraph....
I've downloaded and installed the two adafruit libraries that come with it, and I've run the example sketches without problems.
I want to build my own library to use this bargraph, but I'm getting problems before I even begin to include any of my own functionality. Here's my library....
AsiBargraph.h
#ifndef AsiBargraph_h
#define AsiBargraph_h
extern "C" {
#include <string.h>
}
#include <stdlib.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <Wire.h>
#include <Adafruit_LEDBackpack.h>
#include <Adafruit_GFX.h>
#include <AsiBargraph.h> // header for this library
class AsiBargraph
{
public:
AsiBargraph(); // Constructor
void begin(void); // Setup object
private:
// Member variables
Adafruit_24bargraph _asiBar;
// Private functions
};
#endif
AsiBargraph.cpp
extern "C" {
#include <string.h>
}
#include <stdlib.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <Wire.h>
#include <Adafruit_LEDBackpack.h>
#include <Adafruit_GFX.h>
#include <AsiBargraph.h> // header for this library
/**************************************************************************
Constructor
**************************************************************************/
AsiBargraph::AsiBargraph()
{
}
/**************************************************************************
Do stuff
**************************************************************************/
void AsiBargraph::begin(void)
{
}
As you can see, I've stripped all actual functionality from the library, but as soon as I compile it I get the following errors...
In file included from C:\all_apps\arduino-1.0\libraries\AsiBargraph/AsiBargraph.h:39,
from AsiBargraphTest.cpp:29:
C:\all_apps\arduino-1.0\libraries\Adafruit_LEDBackpack/Adafruit_LEDBackpack.h:56: error: redefinition of 'class Adafruit_LEDBackpack'
C:\all_apps\arduino-1.0\libraries\Adafruit_LEDBackpack/Adafruit_LEDBackpack.h:56: error: previous definition of 'class Adafruit_LEDBackpack'
C:\all_apps\arduino-1.0\libraries\Adafruit_LEDBackpack/Adafruit_LEDBackpack.h:72: error: redefinition of 'class Adafruit_AlphaNum4'
C:\all_apps\arduino-1.0\libraries\Adafruit_LEDBackpack/Adafruit_LEDBackpack.h:72: error: previous definition of 'class Adafruit_AlphaNum4'
I'm sure this is one of those 'staring you in the face errors', the adafruit libraries have been installed and work, the hardware works, the examples compile and run without problem, but as soon as I include the libraries in another one I start getting errors. What have I overlooked?
Thanks