Leonardo r3 keeps disconnecting like 3 seconds after connecting

Im sorry if I put this in the wrong category I didnt know where to ask for help. Ive bought an arduino like 1 month ago and Ive been using it as a mouse for tasks on my computer. Theres never been any problem with it but now all of a sudden I cant use it anymore.

When I connect to the pc like Ive always done hear that windows (10) sound when u connect a new device, then after 3-5 seconds the sound for the device disconnecting happens. The on light is green on the board. When I have open devices in windows settings when I first connect it it recognizes the board and assigns it a COM port, it calls it "Arduino Leonardo Bootloader COM" with a COM port of course, then when I hear the disconnect sound it just calls it "Arduino Leonardo". In device manager it recognizes it as a Arduino Leonardo with a COM port even when its disconnected, also in the IDE it sees it and assigns it a COM port.

I cant upload sketches to it, I tried 1.x and 2.x IDE and I cant write to it with pyserial anymore like Ive done before. Ive tried multiple cable, different ports and assigning it a different COM port number in device manager but nothing works.

Sketch uses 3462 bytes (12%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port COM6
PORTS {COM6, } / {} => {}
PORTS {} / {COM5, } => {COM5, }
Found upload port: COM5
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM5 -b57600 -D -Uflash:w:C:\Users\Fred\AppData\Local\Temp\arduino_build_980236/sketch_jul30a.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "C:\Users\john\AppData\Local\Temp\arduino_build_980236/sketch_jul30a.ino.hex"
avrdude: writing flash (3462 bytes):

Writing | ################################################## | 100% 0.26s

avrdude: 3462 bytes of flash written
avrdude: verifying flash memory against C:\Users\john\AppData\Local\Temp\arduino_build_980236/sketch_jul30a.ino.hex:
avrdude: load data flash data from input file C:\Users\john\AppData\Local\Temp\arduino_build_980236/sketch_jul30a.ino.hex:
avrdude: input file C:\Users\john\AppData\Local\Temp\arduino_build_980236/sketch_jul30a.ino.hex contains 3462 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 3462 bytes of flash verified

avrdude done.  Thank you.

When I upload a blank sketch ^

That was a successful upload. Try uploading the blink sketch and see if it blinks. It's possible the problem is on the PC end.

Do you have any hardware connected to the Leo? If so, are you sure it hasn't failed?

like....sounds as though you are loosing your comms connection...like...try a new lead...... or...like...try posting a photo of your arrangement ...like

Sorry for the no response, I completely forgot I created this thread, the problem was on my python code, I had somehow messed it up. Thanks for tryin to help at least.

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