Bluetooth Connection Troubles

I am trying to connect to my arduino mega with an HC-05 bluetooth module but I keep getting errors when uploading code. Any advice?



An error occurred while uploading the sketch

avrdude: ser_open(): can't open device "\\.\COM9": The system cannot find the file specified.




avrdude: ser_drain(): read error: The handle is invalid.




avrdude: ser_send(): write error: sorry no info avail

avrdude: stk500_send(): failed to send command to serial port

avrdude: ser_recv(): read error: The handle is invalid.




avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: ser_send(): write error: sorry no info avail

avrdude: stk500_send(): failed to send command to serial port

avrdude: ser_recv(): read error: The handle is invalid.




avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: ser_send(): write error: sorry no info avail

avrdude: stk500_send(): failed to send command to serial port

avrdude: ser_recv(): read error: The handle is invalid.




avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: ser_send(): write error: sorry no info avail

avrdude: stk500_send(): failed to send command to serial port

avrdude: ser_recv(): read error: The handle is invalid.




avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: ser_send(): write error: sorry no info avail

avrdude: stk500_send(): failed to send command to serial port

avrdude: ser_recv(): read error: The handle is invalid.




avrdude: ser_recv(): read error: The handle is invalid.




avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: ser_send(): write error: sorry no info avail

avrdude: stk500_send(): failed to send command to serial port

avrdude: ser_recv(): read error: The handle is invalid.




avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_getsync(): timeout communicating with programmer



Is COM9 indeed the board?
Is your HC-05 connected to pins 0 and 1? If so, it will interfere with the upload but does not explain the error The system cannot find the file specified.
Which version of the IDE?

Com9 is outgoing to HC-05, Com8 is incoming. The only connections to the HC-05 are 5V, Ground, TX and RX (connected to RX1 and TX1 respectively). Version 1.8.19

I don't understand. Which COM port is the Mega?

I am trying to connect solely through HC05 like in this video. How to Connect Your Arduino with laptop using Bluetooth HC-05 card - YouTube

Some notes

  1. In that video it seems that the sketch is already loaded to the Arduino via USB.
  2. You can't upload via TX1/RX1 of the Mega, only via TX0/RX0.
  3. For uploads, you need to reset the Mega; I doubt (99% sure) that the HC-05 can do that.
  4. The baudrate is wrong for upload; avrdude will communicate at 115200, I doubt the HC-05 will auto-adjust.

I unfortunately still can't explain why it says that COM9 does not exist. What does Windows device manager say? Does it exist there?

// Edit: fixed some typos and a lost sentence.

One note: don't trust videos where they don't use a resistor in series with a LED.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.