state the function of variable resistor