Gripporillat
Well-known member
Hi everybody,
while trying to construct an object of a class of mine I get this error message:
There seems to be a problem with the default Constructor of my Class. But unfortunately I don't get it.
This is the header:
cpp:
Attached you'll find the whole code including ino and library.
Thank you in advance, I'm sorry for all that code, but I don't know how I could provide a simpler example of this problem.
while trying to construct an object of a class of mine I get this error message:
Arduino: 1.8.8 (Windows 10), TD: 1.45, Board: "Teensy 3.5, MIDI, 120 MHz, Faster, US English"
SkyController: In function 'void construct(Device)':
SkyController:36: error: use of deleted function 'SkyFlash& SkyFlash:perator=(const SkyFlash&)'
flashes[thisdevice.mpxpin_flash-1][inputsonchannel[thisdevice.mpxpin_flash-1][2]] = SkyFlash(potis[thisdevice.mpxpin-1][inputsonchannel[thisdevice.mpxpin-1][thisdevice.type]], thisdevice.teensypin_flash);
^
...\SkyController/SkyController.h:5:0,
...\SkyController.ino:2:
E:\Dropbox\Paraluna\Entwicklung Skycommander\Contollerboard\Teensy\Sketches\libraries\SkyController/SkyFlash.h:11:7: note: 'SkyFlash& SkyFlash:perator=(const SkyFlash&)' is implicitly deleted because the default definition would be ill-formed:
class SkyFlash {
^
...\libraries\SkyController/SkyFlash.h:11:7: error: non-static reference member 'SkyPoti& SkyFlash:oti', can't use default assignment operator
SkyController: In function 'void setup()':
SkyController:51: warning: unused variable 'devices'
Device devices[numberofdevices];
^
use of deleted function 'SkyFlash& SkyFlash:perator=(const SkyFlash&)'
There seems to be a problem with the default Constructor of my Class. But unfortunately I don't get it.
This is the header:
Code:
#ifndef SkyFlash_h
#define SkyFlash_h
#include "Arduino.h"
#include "SkyPoti.h"
#include "Bounce.h"
class SkyFlash {
public:
SkyFlash();
SkyFlash(SkyPoti& Poti, int pin);
~SkyFlash();
void send();
private:
SkyPoti& poti;
Bounce bounce;
};
#endif
cpp:
Code:
#include "Arduino.h"
#include "SkyFlash.h"
#include "SkyPoti.h"
#include "Bounce.h"
SkyPoti defaultpoti;
//default Constructor
SkyFlash::SkyFlash(): poti(defaultpoti), bounce(0, 0) {
}
//Constructor
SkyFlash::SkyFlash(SkyPoti& Poti, int pin) : poti(Poti), bounce(pin, 10) {
pinMode(pin, INPUT_PULLUP);
}
//Destructor
SkyFlash::~Skyflash() {
}
//flash that thing!
void SkyFlash::send() {
bounce.update();
if (bounce.fallingEdge()) {
poti.flash(true);
} else if (bounce.risingEdge()) {
poti.flash(false);
}
}
Attached you'll find the whole code including ino and library.
Thank you in advance, I'm sorry for all that code, but I don't know how I could provide a simpler example of this problem.