Some Pins Not Working as Output

To test which code I can use as outputs, I wrote a simple script:

pins = [D0,D1,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13,D14,D15,D16,D17,D18,D19,D2,D21,D22,D23,D24,D26,D28,D30,D32,D34,D36,D38,D40]
for p in pins:

# Define the ‘blink’ function to be used by the threads

def blink(pin,timeON=100,timeOFF=100): # delayON and delayOFF are optional parameters, used as default
# if not specified when you call the function
while True:
digitalWrite(pin,HIGH) # turn the LED ON by making the voltage HIGH
sleep(timeON) # wait for timeON
digitalWrite(pin,LOW) # turn the LED OFF by making the voltage LOW
sleep(timeOFF) # wait for timeOFF

# Create threads that execute instances of the ‘blink’ function.

for p in pins:

All pins starting blinking except the following:

Is there a reason why these pins don’t operate as output?

thanks in advance
iomariPreformatted text

You did not mention which board you are using, If you are using ESP32 then the reason is the hardware restrictions.
On ESP32 there are some pins that are connected to SPI interface, other pins are Input only, other pins need certain configuration during boot up.
check the datasheet of the ESP32 and the development board you are using for more info on the hardware restrictions.

Sorry, I’m using the Nordic nRF52480 Dk

Please check the reference manual for the MCU pins