Arduino Micro only executes code when serial is open from PC side

The "while serial" code waits for the USB port and is not always needed for most boards.

If you remove that (so long as its not a board that depends on it) then it will start the sketch and send data all day long without waiting for the USB to a computer to be connected.