Hi there,....
I'm using an Adafruit library for an analog/digital converter. Everything works just fine and as long as everything happens inside my .ino file I can happily read values of voltages:
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1015 myADC(0x48);
void setup()
{
myADC.begin();
}
void loop()
{
myADC.readADC_SingleEnded(12);
}
Here's where I run into problems:
I want to use my own class (myClass), declared in my own header file (myClass.h) and I want THAT class to be able to use the library.
myClass.h:
#pragma once
#include <Arduino.h>
class myClass
{
public:
myClass();
void read();
};
myClass.cpp:
#include "myClass.h"
myClass::myClass()
{
}
void myClass::read()
{
//read something();
}
Here's my Question:
Where do I put the #include <Adafruit_ADS1015.h> ?
Where do I declare the object Adafruit_ADS1015 myADC(0x48); ?
Where do I call myADC.begin(); ?
...so far I tried every possible combination (literally), but none worked. Errormessages indicate that the object myADC never gets created
Eventually I came up with the idea of creating an instance of "myADC" inside the .ino file and hand it over to the instance of "myClass" upon creation, so that it can work with it, but how would I do that?
Can someone help me out here?