Have you got a current limit resistor in series with the LED?
What Arduino controller are you using?
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Hi everyone.
Thank you for all the replies.
I discovered that the reset problem was caused by a watchdog timer connected to the circuit's reset line. When this timer is not triggered, it resets the microcontroller.
I use this timer to wake up the MCU every minute, as I turn it off completely to save power.
Therefore, this topic could be closed. Additional information below.
I have another question about the possibility of using the <SPI.h> library for the atmega4809 chip, so I ask: should I ask here or open another topic?
That shows that you should provide full information in an opening post; in this case your opening post should have included the schematic. Somebody could have picked up the WDT as a possible culprit 23 hours ago