Potentiometer regulating motor...noot easy

how would you translate it into code? i'm not an expert yet