Potentiometer code (untested)

Haven't tried with the actual potentiometer yet