it's declared in a class only if the library uses a class. if it is declared in a class, it must be public for you to access it. For example
If this is in the library's header file
class HardwareSerial
{
public:
int theVariableYouWantToAccess;
private:
int someOtherStuffYouCannotAccess;
};
extern HardwareSerial Serial;
then you can do something like
Serial.theVariableYouWantToAccess = 1;
inside your own sketch
if it's not inside a class, then you should be able to access it by using "extern" inside your sketch. For example
if your library has a .c or .cpp file that looks like
int theVariableYouWantToAccess;
void foo()
{
theVariableYouWantToAccess++;
}
then your sketch can look like
extern int theVariableYouWantToAccess;
void setup()
{
}
void loop()
{
theVariableYouWantToAccess = 0;
}
or you can have a header file that contains
#ifndef headerFile_h
#define headerFile_h
extern int theVariableYouWantToAccess;
#endif
and your sketch looks like
#include <headerFile.h>
void setup()
{
}
void loop()
{
theVariableYouWantToAccess = 0;
}