16x2 LCD control

Hi all,
I would like to be able to turn the backlight of a 16x2 LCD shield (Gravity: 1602 LCD Keypad Shield For Arduino - DFRobot) on and off with a momentary pushbutton. I have followed the instructable here (https://www.instructables.com/id/Arduino-Based-LCD-Digital-Clock/) to make a simple bedside clock.

The backlight is very bright, and so i would like to have a momentary pushbutton located on the top of the clock housing to illuminate the LCD when pushed, and then let the backlight go off when the button is released.

Can I just cut the PCB track to pin D10, and then wire the PB switch across the break in the track, so as to complete the circuit when the button is pressed? ( not my preferred option)


How can i write this on/off backlight control into the sketch?

Many thanks,

LCD_digital_clock_ds1307.ino (10.6 KB)

Or get an LCD that isn't already made into a shield so you can poser the backlight pin from Arduino and Arduino can decide when to turn it on or off.