I am having problems when I connect the usb cable with my arduino leonardo. I used it all day and had even uploaded some sketches, now it seems to be stuck. When I plug it into the usb it doesn't recognize the arduino instantly, it only recognizes the arduino when I press the reset button, it stays connected with windows for a few seconds and disconnects, as if I unplugged the usb cable.
The 32U4 processor has integrated USB-serial functionality. It's possible to "brick" it with a rogue sketch. Luckily there is a standard procedure to unbrick it, I believe it is documented somewhere on this site. Maybe the product page?
Indeed, it has to do with pressing the reset button immediately before uploading... it may take a few tries to get the timing right. Once you can upload an empty sketch, the USB bootloader is restored and you can upload any sketch.