How to control the display's backlight in the sketch?

the voltage across an LED also depends on it's current, but not linearly as with a resistor.

When you have some time, try to plot a LED's V-I curve. You will be surprised. Particularly for high power LEDs.