I flashed a hex file on my Arduino pro micro for a keyboard I was making. The keyboard was not working properly so I wanted to try to write some code on the Arduino IDE first. When I go to the IDE my board does not show up as a com port. Can someone tell me what I can do to fix this issue?
Due to the USB stack running on the same ATmega32U4 microcontroller as your program on the Pro Micro, it is possible for code in your program to break the USB functionality, which can lead to the port no longer appearing.
Fortunately, the upload code (bootloader) is stored in a separate section of memory and can not be broken by the program code.
The only tricky thing is that the bootloader has to be activated at just the right time during the upload. Normally this is done by some special code that runs in the background of your sketch code recognizing a 1200 baud connection as the signal to reset the microcontroller and start the bootloader. However, in your current situation, that system won't work so you'll need to manually reset the board to activate the bootloader.
You need to get the timing right. If you do the reset too early, the bootloader will have already timed out by the time the upload starts. The tricky thing is that when you press the "Upload" button in the Arduino IDE, it first compiles your sketch before starting the actual upload. So you need to wait until after the compilation finishes before resetting the board.
Prepare some way to reset your Pro Micro by momentarily connecting the RST pin to the GND pin. This could be done with a wire or even some metal tweezers.
Select Sketch > Upload from the Arduino IDE's menus.
Watch the black console window at the bottom of the Arduino IDE window until you see something like this:
Sketch uses 444 bytes (1%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables.
Maximum is 2048 bytes.
Immediately reset the Arduino board.
After that, the sketch should upload successfully and you should then see a port for your board and be able to resume normal uploads.
Just realized that I have added a simple blink program. though when I try to upload the code an error message pops up. I can not copy the message because when it comes the IDE is still stuck on uploading.
Thanks for the help ,the problem is resolved. I closed all other apps which removed the error message and then I was able to reset my Arduino as you previously instructed and it uploads all the programs fine now.