PaulRB:
Right, so what I think is that the temp band controls the wavelength of the sine wave. In the instant when that wavelength changes, we want to remain at the same point on the sine curve, so there is no sudden change in led brightness. I'll have a think.
Yes, or only changes the wavelength when val reaches zero