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

I may be mistaken but it appears to me that you are giving support to those who think that the LEDs that they are using with their Arduinos have a voltage rating (like a light bulb), and if they apply this voltage to their LED it will work properly.

Myself and other contributors such as Grumpy Mike and Liudr have, for several years, been giving advice on why this reasoning is incorrect an why they always need current limiting, usually in the form of a series current limiting resistor, when driving an LED.

Keep in mind that the target audience for the Arduino is not someone with an Engineering background and frequently not even someone with the slightest interest in electronics or microcontrollers. They are not concerned with the output resistance of an avr etc. and statements such as "For the same change in Vfwd, the led's If increased much less than a diode's" might just as well be written in Zorkonian. They are, however, interested in getting their LED to light up without damaging either the LED or their Arduino.

The bottom line is one can mess around with PWM, diodes, or some combination, but one should still use a series current limiting resistor with their LED.

Don