The 16x2 LCD & Keypad Shield allows you to control the intensity of the backlight using Arduino digital pin D3. By setting pin D3 HIGH, the backlight will be fully on. By setting it LOW, the backlight will be fully off.
Varying Backlight Intensity
We specifically chose pin D3 to control the backlight because it's one of the Arduino pins that is capable of "PWM", or Pulse Width Modulation. Using PWM you can vary the intensity of the backlight by setting pin D3 to different levels between 0% (with a value of 0) and 100% (with a value of 255) using the analogWrite() function.
For example, to set the level to 50% (half on) you could set pin D3 to a value of 127:
analogWrite(3, i);
You could even make the backlight "pulse" by stepping it through values from 0 to 255 and back again:
void loop() { int i; for (i = 0; i < 256; i++) { analogWrite(3, i); delay(4); } for (i = 255; i > 0; i--) { analogWrite(3, i); delay(4); } }
Changing Backlight Control Pin
If you want to combine the 16x2 LCD & Keypad Shield with another shield that also uses Arduino pin D3, you may want to change the backlight control over to another Arduino pin. Luckily the shield is designed to make this easy to do.
If you look near the top right corner of the schematic for the shield you'll see jumper positions called "LINK1" through "LINK8". By default, "LINK2" is bridged so that D3 is the selected backlight control pin:
Each of those numbered links is a pair of pads on the shield, as highlighted here:
The pair of pads labelled "D3" is connected on the PCB by a tiny track that you can barely see, so the first step is to use a sharp knife such as a hobby scalpel to cut the track between the two pads. You can see the track in this screenshot of the PCB design, just below the text "LINK2":
Now that you've disconnected Arduino pin D3 from the backlight control, you can either leave the backlight control disconnected entirely (in which case it will be permanently on) or connect it to a different pin using one of the other pairs of jumpers. Pick the pin you want to use to control the backlight, keeping in mind that not all pins can do PWM so you may only be able to turn the backlight on or off rather than vary its brightness, and bridge across those pads using a blob of solder.
Then update your sketch to use the new pin to control the backlight, and you're done!