|
|
@ -6,17 +6,17 @@
|
|
|
|
int AC_pin_offset = 22; // lowest out for lights
|
|
|
|
int AC_pin_offset = 22; // lowest out for lights
|
|
|
|
int dims[18]; // dimmer values
|
|
|
|
int dims[18]; // dimmer values
|
|
|
|
unsigned char clock_tick; // variable for Timer1
|
|
|
|
unsigned char clock_tick; // variable for Timer1
|
|
|
|
unsigned int delay_time = 50;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.begin(115200);
|
|
|
|
for(int i = 0; i < 18; i++){
|
|
|
|
for(int i = 0; i < 18; i++){
|
|
|
|
dims[i] = 110;
|
|
|
|
dims[i] = 256;
|
|
|
|
// Set the pins to the triacs as outputs (using outs 0 - 17)
|
|
|
|
// Set the pins to the triacs as outputs (using outs 0 - 17)
|
|
|
|
pinMode(AC_pin_offset + i, OUTPUT);
|
|
|
|
pinMode(AC_pin_offset + i, OUTPUT);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
attachInterrupt(0, zero_crosss_int, RISING);
|
|
|
|
attachInterrupt(0, zero_crosss_int, RISING);
|
|
|
|
Timer1.initialize(65); // set a timer of length 100 microseconds for 50Hz or 83 microseconds for 60Hz;
|
|
|
|
// for resoution of 128 steps, set timer so 33 microseconds for 60 Hz or 39 for 50 Hz
|
|
|
|
|
|
|
|
Timer1.initialize(39);
|
|
|
|
Timer1.attachInterrupt(timerIsr); // attach the service routine here
|
|
|
|
Timer1.attachInterrupt(timerIsr); // attach the service routine here
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|