If you are doing IFR-when you request clearance the ATC person will say a squawk code. This is what you put in the transponder.
If VFR-the ATC person will give you a squawk code after taking off. Until the controller does this-keep your transponder at 1200.