This library doesn't work with MySensor lib,
main.cpp.o (symbol from plugin): In function atexit':
(.text+0x0): multiple definition of main'
Example code
`#define MY_GATEWAY_SERIAL
#include <SPI.h>
#include <MySensors.h>
#include <Bounce2.h>
#include <dimmable_light.h>
#include <Wire.h>
#include <PCF8574.h>
const int SYNC_PIN = 2;
const int AC_PIN = 3;
DimmableLight light(AC_PIN);
int brightness = 0;
int fadeAmount = 5;
byte dim1 = 0;
const int period = 1000;
void setup() {
Serial.println();
Serial.println("Dimmable Light for Arduino: second example");
Serial.println();
Serial.begin(115200);
DimmableLight::setSyncPin(SYNC_PIN);
DimmableLight::begin();
}
void loop() {
for (brightness = 0; brightness <= 100; brightness += fadeAmount) {
dim1 = (int)(brightness / 100. * 255);
Serial.println(dim1);
light.setBrightness(dim1);
delay(period);
}
// Rozjasnianie
for (brightness = 100; brightness >= 0; brightness -= fadeAmount) {
dim1 = (int)(brightness / 100. * 255);
Serial.println(dim1);
light.setBrightness(dim1);
delay(period);
}
}
`
- Library version: everyone
- Arduino core: 1.8.3
- Enviroment/IDE: Arduino IDE
- Dimmer board:
- Board: nano
This library doesn't work with MySensor lib,
main.cpp.o (symbol from plugin): In functionatexit':(.text+0x0): multiple definition of
main'Example code
`#define MY_GATEWAY_SERIAL
#include <SPI.h>
#include <MySensors.h>
#include <Bounce2.h>
#include <dimmable_light.h>
#include <Wire.h>
#include <PCF8574.h>
const int SYNC_PIN = 2;
const int AC_PIN = 3;
DimmableLight light(AC_PIN);
int brightness = 0;
int fadeAmount = 5;
byte dim1 = 0;
const int period = 1000;
void setup() {
Serial.println();
Serial.println("Dimmable Light for Arduino: second example");
Serial.println();
Serial.begin(115200);
DimmableLight::setSyncPin(SYNC_PIN);
DimmableLight::begin();
}
void loop() {
for (brightness = 0; brightness <= 100; brightness += fadeAmount) {
dim1 = (int)(brightness / 100. * 255);
Serial.println(dim1);
light.setBrightness(dim1);
delay(period);
}
// Rozjasnianie
for (brightness = 100; brightness >= 0; brightness -= fadeAmount) {
dim1 = (int)(brightness / 100. * 255);
Serial.println(dim1);
light.setBrightness(dim1);
delay(period);
}
}
`