Code for driving brightness. You may need a resistor on the input to the laser if you are driving at a full 5 volts.