I just watched a tutorial on Youtube on how to create an array of objects. Wasn't too helpful.
Heres PixelLib.h:
#ifndef pixel
#define pixel
#if (ARDUINO > 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class PixelLib {
public:
PixelLib(int x, int y, int amp);
PixelLib();
void scroll();
int getX();
int getY();
int getAmp();
private:
int x;
int y;
int amp;
};
#endif
Heres PixelLib.cpp
#include "Pixel.h"
PixelLib::PixelLib(int x, int y, int amp) {
}
PixelLib::PixelLib() {
x = 0;
y = 0;
amp = 0;
}
void PixelLib::scroll() {
x++;
}
int PixelLib::getX() {
return x;
}
int PixelLib::getY() {
return y;
}
int PixelLib::getAmp() {
return amp;
}
I'm trying to create an array of PixelLib objects in this line of code in my sketch:
PixelLib pixels[256];
I'm not getting an error there though. I'm getting in error in PixelLib.cpp. It says prototype for 'PixelLib::PixelLib()' does not match any in class 'PixelLib'. I'm pretty sure it's saying the signatures for the empty constructors are different, but I don't see how.