main function of variable resistor