Micro not recognized by computer

I found the problem due to the anti-static foam that came attached to the header pins. On removing the foam, Micro got recognized by computer and sketch could be uploaded. Perhaps some pins were getting shorted by the conducting foam.