I know what BCM and BOARD mean when you set up the pi to work with the GPIO coding in python.

Recently a had a look in some code for raspberry written in c++ and everything is okay but how the code refers to the pins I don´t get it instead of using the GPIO pin #17 just like in BMC mode.

int led = D1; 

I'm looking for a table or image like those on google that tell you the pins and the numbers but I can't find one for this convention.

I'm looking for a pinout diagram or something like that to know what pins are we working within this c++ piece of code.

This is the C++ code in particle's web IDE:

// -----------------------------------------
// Demonstrate Particle and IFTTT
/* -----------------------------------------
This program subscribes to a a particle event.
An IFTTT app monitors inbox activity of a Gmail account and publishes events to the Particle Cloud.

int led = D1;
int boardLed = D7;

// setup() is run only once, it's where we set up GPIO and initialise peripherals
void setup() {

  // Setup GPIO
  pinMode(led,OUTPUT); // Our LED pin is output (lighting up the LED)
  pinMode(boardLed,OUTPUT); // Our on-board LED is output as well

  // Escribimos que los leds estan incialmente apagados

  // Subscribe to an event published by IFTTT using Particle.subscribe
  Particle.subscribe("evento_de_led_para_trabjar", myHandler);
  // TODO:
  // Subscribe will listen for the event unique_event_name and, when it finds it, will run the function myHandler()
  // (Remember to replace unique_event_name with an event name of your own choosing. Make it somewhat complicated to make sure it's unique.)
  // myHandler() is declared later in this app.

// loop() runs continuously, it's our infinite loop. In this program we only want to repsond to events, so loop can be empty.
void loop() {
// Extrañaba la famila de lenguajes de C ajaja

// LA siguiente sera una funcion que no retorna nada.... entonces es void

// Now for the myHandler function, which is called when the Particle cloud tells us that our email event is published.
void myHandler(const char *event, const char *data)
  /* Particle.subscribe handlers are void functions, which means they don't return anything.
  They take two variables-- the name of your event, and any data that goes along with your event.
  In this case, the event will be "buddy_unique_event_name" and the data will be "on" or "off"

  if (strcmp(data,"led-off")==0)
    // if subject line of email is "off"

  else if (strcmp(data,"led-on")==0)

    // if subject line of email is "on"

  • care to share link to what you were looking at ? given it was c++, it is possible D1 might have been a #define Jul 17, 2018 at 17:37
  • You can't run Arduino code on a Pi
    – Milliways
    Jul 18, 2018 at 3:36

2 Answers 2


I have not seen any standard numbering scheme for the Pi which uses GPIO identifiers such as D1.

My guess would be that this usage is local to the software you were looking at.

D1 is defined in pinmap_hal.h

The naming convention seems to have been adopted from the wiring system used by Arduino.


D1 is used to denote "digital pin 1" on the Arduino. Similarly A1 is "analog pin 1". Are you sure the code is referring to Raspberry Pi pins? It looks like Arduino code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.