The code is actually working perfectly but the led is not bright enough. I also tested with other pins, but the result was the same. Is there any way to fix this?
There are lots of things that limit the current. It is also advised to add a resistor since you don’t want to draw too much current from a GPIO as they have low tolerances. However, since it is not bright enough without a resistor I skipped that part as being irrelevant. The uC should not be used as a power supply. Alternatively just try another LED but look at the schematics used for attaching to a microcontroller
If I read the uC documentation correctly it suggests 4.7 mA from each GPIO pin. Not enough to power standard LED to full brightness. You are probably exceeding limits
I need to drive a buzzer also from the same output or other. Shall I use 3.3V coming from Arduino itself(the VDDIO_EXT pin in the above image) to drive the led by MOSFET? Is it recommended