I have already posted the code.Analog source is simply a pot for 1-5V range.