' listing for sunset-lamp ' Parameters: ' b4 = PWM-frequency selection ' w5 = timescale, may be adjusted by potentiometer from 750ms to 5100s ' w6 = paramter for PWM-Duty. w6 = 10 means 1% duty, 990 means 99% duty sertxd("62") ' at start, the picaxe sends back the number of Softwareversion currently stored in it. b4 = 255 ' Parameter for PWM 249 = 4kHz readadc10 2,w5 ' 25k potentiometer and 4.7k resistor in row on pin 2 w5 = w5 * 5 ' Timescale is extended let pins = 0 ' initially set everything off if pin1 = 0 then sunrise ' Check if sunrise or sunset from pin6 sunset: let pins = %00110001 ' selection of LED-strings for w6 = 990 to 700 step -1 ' Loop do decrease the brightness gosub kreis ' subprocedure to set the pwm w6 = w6 * 32 / 33 ' exponential decline of w6 next w6 let pins = %00110100 ' next step with other LED-strings for w6 = 900 to 650 step -1 gosub kreis w6 = w6 * 31 / 33 next w6 let pins = %00010110 for w6 = 800 to 450 step -1 gosub kreis w6 = w6 * 25 / 26 next w6 let pins = %00000110 for w6 = 700 to 100 step -1 gosub kreis w6 = w6 * 19 / 20 next w6 let pins = %00000010 for w6 = 800 to 10 step -1 gosub kreis w6 = w6 * 7 / 8 next w6 let pins = 0 ' Everything off stop sunrise: let pins = %00010001 for w6 = 10 to 700 step 1 gosub kreis w6 = w6 * 8 / 7 next w6 let pins = %00110001 for w6 = 300 to 800 step 1 gosub kreis w6 = w6 * 20 / 19 next w6 let pins = %11110001 for w6 = 400 to 990 step 1 gosub kreis w6 = w6 * 33 / 32 next w6 stop kreis: ' subprocedure for a change in PWM-Settings pwmout 3, b4, w6 ' change PWM to current value of w6 pause w5 ' wait for some time return ' return to the line after the gosub-command