黃 韋傑 says to 《除霜工程師—NJ》
for i=1 , 10 do if z==0 then width1 = width1 - 1023*0.1 elseif width1 > z*1023*0.1 then width1 = width1 - (z*0.1*1023) end pwm.setduty(ledr,width1) tmr.delay(100000) end for i=1 , 10 do if y==0 then width2 = width2 - 1023*0.1 elseif width2 > y*1023*0.1 then width2 = width2 - (y*0.1*1023) end pwm.setduty(ledy,width2) tmr.delay(100000) end for i=1 , 10 do if x==0 then width3 = width3 - 1023*0.1 elseif width1 > x*1023*0.1 then width3 = width3 - (x*0.1*1023) end pwm.setduty(ledg,width3) tmr.delay(100000) end tmr.delay(1000000) pwm.close(ledr) pwm.close(ledg) pwm.close(ledy) gpio.write(ledr, gpio.LOW) gpio.write(ledy, gpio.LOW) gpio.write(ledg, gpio.LOW) tmr.delay(500000) end)