How to Dim and Brighten Lights and Text Render?

Hello, I am trying to figure out how to make it so I can brighten and dim a light using certain keys? I am also trying to figure out how to use a text render that keeps track of how many times I have turned the light on and off?