Running the LED with pulses instead of DC won't reduce the heat the LED generates at the same brightness. In fact, it will make that a little worse.
You can run the LED dimmer than full brightness using pulses, and have the LED dissipate less power than at full brightness. However, just switching between 1/2 on and 1/2 off will give you close to 50% brightness, but will cause the LED to dissipate a little more power than if it were run steadily at 50% current. That is because the voltage drop across the LED is a bit higher at full current than at half current.
To actually do the switching controlled by a digital logic signal, the easiest is to use a "logic FET" low side switch. Something like the IRLML2502 can be driven directly from a 3.3 V or 5 V logic signal on its gate. Ground the source, and connect the LED between 12 V power and the drain.