Unable to use D0 pin

I tried to use example “blink-an-led” library and result is that D7 (activity) blinks on RPI as expected, but D0 not work at all. After that I changed to D1 (GPIO17) then this port works well.

What could be issue with D0 (GPIO4) pin?


I have a small ap running on a pi3 that subscribes to published events from some photons. When it receives a published event, it sends the received data to the serial port of the pi (particle-agent serial). But also it blinks an LED connected to D0 (GPIO4). Works fine!

I tried following code:

int led1 = D0;
int led2 = D7;

void setup() {
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);

void loop() {
  digitalWrite(led1, HIGH);
  digitalWrite(led2, HIGH);


  digitalWrite(led1, LOW);
  digitalWrite(led2, LOW);


And D0 does not blink a led. If i change it to D1 for example, then led blinks. No errors in particle-agent logs.

Just ran your code, and both LED’s blink, sorry.

This might be due to different Raspberry Pi revisions having different pin mappings.

I do my development on a Pi 3 and verified the pin mapping on a Pi 2 and Pi Zero.

Which Pi are you using?