Do you have some code. A schematic or better description of the "var resistor" or do you mean potentiometer as a voltage divider would help.