diff --git a/arduino/remembering_clive_wearing_arduino.ino b/arduino/remembering_clive_wearing_arduino.ino index e531b26..73e5fc3 100644 --- a/arduino/remembering_clive_wearing_arduino.ino +++ b/arduino/remembering_clive_wearing_arduino.ino @@ -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 diff --git a/remembering_clive_wearing_score.pdf b/remembering_clive_wearing_score.pdf index 956a7b1..7ba47ab 100644 Binary files a/remembering_clive_wearing_score.pdf and b/remembering_clive_wearing_score.pdf differ diff --git a/supercollider/remembering_clive_wearing_visuals.scd b/supercollider/remembering_clive_wearing_visuals.scd index c1a439a..2a68f5b 100644 --- a/supercollider/remembering_clive_wearing_visuals.scd +++ b/supercollider/remembering_clive_wearing_visuals.scd @@ -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 }, {});