<分区>
这可能是我错过的一些愚蠢的东西,但现在我一直收到这个错误:(。请帮忙!!这是我在 C++ 中的第一个库,所以我可能搞砸了语法。
此错误出现在这行代码中
displayLED(int heightOfDisplay = 8, int widthOfDisplay = 32);
这是.h文件中的代码
#ifndef displayLED
#define displayLED
#include "Arduino.h"
#include <math.h>
#include <string.h>
class displayLED
{
private:
static const int heightOfDisplay;
static const int widthOfDisplay;
int verticalArray[8];
int horizontalArray[32];
int cursorPosition=0;
const int latchPin = 8;
const int clkPin = 7;
const int REDhorizontalSO = 6;
const int GREENhorizontalSO = 11;
const int BLUEhorizontalSO = 9;
const int verticalSO = 12;
public:
displayLED(int heightOfDisplay = 8, int widthOfDisplay = 32);
displayLED();
void constructWord(String Word = "WELCOME");
void slideIn(String colorAnimator);
void fillArrays();
void pushToRegister(int sthToWrite1[], int sthToWrite2[], int sthToWrite3[], int sthToWrite4[], int SOpin1, int SOpin2, int SOpin3, int SOpin4);
void shiftOutMultiple(uint8_t dataPin1, uint8_t dataPin2, uint8_t dataPin3, uint8_t dataPin4, uint8_t clockPin, uint8_t bitOrder, uint8_t val1, uint8_t val2, uint8_t val3, uint8_t val4)
};
#endif
这是我的 .cpp。为了简洁起见,我省略了其他功能。我希望它清楚。
#include "displayLED.h"
displayLED::displayLED(int heightOfDisplay, int widthOfDisplay) {
this->heightOfDisplay = heightOfDisplay;
this->widthOfDisplay = widthOfDisplay;
pinMode(latchPin , OUTPUT);
pinMode(clkPin , OUTPUT);
pinMode(REDhorizontalISO , OUTPUT);
pinMode(GREENhorizontalSO , OUTPUT);
pinMode(BLUEhorizontalSO , OUTPUT);
pinMode(vertcalISO , OUTPUT);
fillArrays();
}
displayLED::displayLED() {
}
//this function fills all the array with zeros
void displayLED::fillArrays() {
for(int j=0; j <= heightOfDisplay; j++) {
verticalArray[j] = 0;
}
for(int j=0; j <= widthOfDisplay; j++) {
horizontalArray[j] = 1;
}
}