You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When connecting multiple lamps, there is interference in brightness, changing the power of one lamp changes the other. Even two dimmer are not working properly. Refer the example below:
`
#include <RBDdimmer.h>
//#define USE_SERIAL SerialUSB //Serial for boards whith USB serial port
#define USE_SERIAL Serial
#define Ch0 3
#define Ch1 9
int ch_sel;
int ch_pow;
#define zerocross 2 // for boards with CHANGEBLE input pins
dimmerLamp dimmer0(Ch0);
dimmerLamp dimmer1(Ch1);
void setup() {
USE_SERIAL.begin(9600);
dimmer0.begin(NORMAL_MODE, ON); //dimmer initialisation: name.begin(MODE, STATE)
dimmer1.begin(NORMAL_MODE, ON);
USE_SERIAL.println("Lamp Controller - 1 Online");
}
void loop() {
if (USE_SERIAL.available()) {
char ch = USE_SERIAL.read();
if (ch == '#') {
ch_sel = USE_SERIAL.parseInt();
ch_pow = USE_SERIAL.parseInt();
if (ch_pow <= 100 && ch_pow >= 0) {
switch (ch_sel) {
case 0:
dimmer0.setPower(ch_pow);
break;
case 1:
dimmer1.setPower(ch_pow);
break;
default:
USE_SERIAL.println("Error 1");
break;
}
delay(20);
USE_SERIAL.print(ch_sel);
USE_SERIAL.print(',');
USE_SERIAL.println(ch_pow);
USE_SERIAL.flush();
}
else
USE_SERIAL.println("Error 2");
} else
{
USE_SERIAL.read();
}
}
}
`
The text was updated successfully, but these errors were encountered:
When connecting multiple lamps, there is interference in brightness, changing the power of one lamp changes the other. Even two dimmer are not working properly. Refer the example below:
`
#include <RBDdimmer.h>
//#define USE_SERIAL SerialUSB //Serial for boards whith USB serial port
#define USE_SERIAL Serial
#define Ch0 3
#define Ch1 9
int ch_sel;
int ch_pow;
#define zerocross 2 // for boards with CHANGEBLE input pins
dimmerLamp dimmer0(Ch0);
dimmerLamp dimmer1(Ch1);
void setup() {
USE_SERIAL.begin(9600);
dimmer0.begin(NORMAL_MODE, ON); //dimmer initialisation: name.begin(MODE, STATE)
dimmer1.begin(NORMAL_MODE, ON);
USE_SERIAL.println("Lamp Controller - 1 Online");
}
void loop() {
if (USE_SERIAL.available()) {
char ch = USE_SERIAL.read();
if (ch == '#') {
ch_sel = USE_SERIAL.parseInt();
ch_pow = USE_SERIAL.parseInt();
if (ch_pow <= 100 && ch_pow >= 0) {
switch (ch_sel) {
case 0:
dimmer0.setPower(ch_pow);
break;
case 1:
dimmer1.setPower(ch_pow);
break;
default:
USE_SERIAL.println("Error 1");
break;
}
delay(20);
USE_SERIAL.print(ch_sel);
USE_SERIAL.print(',');
USE_SERIAL.println(ch_pow);
USE_SERIAL.flush();
}
else
USE_SERIAL.println("Error 2");
} else
{
USE_SERIAL.read();
}
}
}
`
The text was updated successfully, but these errors were encountered: