changes for 240 volts
This commit is contained in:
parent
04374cd76b
commit
ab7af6f06b
|
|
@ -6,18 +6,18 @@
|
|||
int AC_pin_offset = 22; // lowest out for lights
|
||||
int dims[18]; // dimmer values
|
||||
unsigned char clock_tick; // variable for Timer1
|
||||
unsigned int delay_time = 50;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
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)
|
||||
pinMode(AC_pin_offset + i, OUTPUT);
|
||||
};
|
||||
attachInterrupt(0, zero_crosss_int, RISING);
|
||||
Timer1.initialize(65); // set a timer of length 100 microseconds for 50Hz or 83 microseconds for 60Hz;
|
||||
Timer1.attachInterrupt( timerIsr ); // attach the service routine here
|
||||
// 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
|
||||
}
|
||||
|
||||
// this is the dimmer
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -59,10 +59,13 @@ refresh_func = { while { true } {
|
|||
|
||||
// updateArduino
|
||||
if(~arduino == 1, {
|
||||
{|i|
|
||||
// set min and max Brightness between 0 and 1 depending on wattage of light
|
||||
// it is best to keep the min slightly higher than 0 to keep the light from turning completely off
|
||||
{|i| var minBrightness = 0.1, maxBrightness = 0.9;
|
||||
arduino_port.putAll(i.asString);
|
||||
arduino_port.put(Char.space);
|
||||
arduino_port.putAll(((brightness[i] - 1).abs * 110).trunc.asString);
|
||||
arduino_port.putAll((((brightness[i] * (maxBrightness - minBrightness) + minBrightness) - 1).abs * 256)
|
||||
.trunc.asString);
|
||||
arduino_port.put(Char.space);
|
||||
arduino_port.put(13);
|
||||
} ! 18 }, {});
|
||||
|
|
|
|||
Loading…
Reference in a new issue