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

I've used 2 diodes 1n4007 insthead the resistor ( series ) and it works great.

You don't understand the problem. This is a different way of reducing the maximum voltage applied to the backlight. The problem is that it is the current rating of the diode that we don't want to exceed.

Once again: if you to try to design a circuit to drive an LED with some specific voltage you are doomed to failure.

Don