Ho avuto la necessità di creare librerie per ogni componente che utilizzo nel processo, quindi ho creato la libreria che gestisce l'lcd, ho un errore di compilazione che non riesco a risolvere.
File principale:
#include "LcdLib.h"
#include <SerialCommand.h>
#include <SoftwareSerial.h>
#include <LedDisplay.h>
SerialCommand SCmd;
uint8_t LCD_DATA_PIN = 6;
uint8_t LCD_REGISTER_SELECT = 7;
uint8_t LCD_CLOCK_PIN = 8;
uint8_t LCD_ENABLE = 9;
uint8_t LCD_RESET = 10;
int LCD_BRIGHTNESS = 15;
Lcd lcd( LCD_DATA_PIN, LCD_REGISTER_SELECT, LCD_CLOCK_PIN,
LCD_ENABLE, LCD_RESET, LCD_BRIGHTNESS );
void setup() {
Serial.begin(9600);
lcd.begin();
SCmd.addCommand("CDS",PrintByLcd);
}
void loop() {
// put your main code here, to run repeatedly:
SCmd.readSerial();
}
void PrintByLcd(){
String str = SCmd.next();
lcd.write( str );
Serial.println("ok");
}
File.h:
#ifndef LCD_h
#define LCD_h
#include <Arduino.h>
#include <LedDisplay.h>
class Lcd
{
public:
Lcd( uint8_t LCD_DATA_PIN, uint8_t LCD_REGISTER_SELECT, uint8_t LCD_CLOCK_PIN, uint8_t LCD_ENABLE, uint8_t LCD_RESET, int LCD_BRIGHTNESS );
void begin();
void write( String out );
private:
uint8_t DATA_PIN, REGISTER_SELECT, CLOCK_PIN, ENABLE, RESET;
int BRIGHTNESS;
LedDisplay myDisplay;
};
#endif
file.cpp:
#include "Arduino.h"
#include "LcdLib.h"
#include <LedDisplay.h>
Lcd::Lcd( uint8_t LCD_DATA_PIN, uint8_t LCD_REGISTER_SELECT, uint8_t LCD_CLOCK_PIN, uint8_t LCD_ENABLE, uint8_t LCD_RESET, int LCD_BRIGHTNESS )
{
this->DATA_PIN = LCD_DATA_PIN;
this->REGISTER_SELECT = LCD_REGISTER_SELECT;
this->CLOCK_PIN = LCD_CLOCK_PIN;
this->ENABLE = LCD_ENABLE;
this->RESET = LCD_RESET;
this->BRIGHTNESS = LCD_BRIGHTNESS;
}
void Lcd::begin(){
myDisplay = LedDisplay(DATA_PIN, REGISTER_SELECT, CLOCK_PIN, ENABLE, RESET, 8);
myDisplay.begin();
myDisplay.setBrightness(BRIGHTNESS);
}
void Lcd::write( String str ){
myDisplay.home();
if( !str ){
myDisplay.print(" ");
}else{
myDisplay.print(str);
}
}
e l'errore è: "no matching function for call to 'LedDisplay::LedDisplay()' "
Grazie in anticipo