# PLATFORM\_ID values for all Particle products

**URL:** <https://community.particle.io/t/platform-id-values-for-all-particle-products/64821>\
**Category:** Firmware\
**Created:** [June 25, 2023, 10:10am UTC](https://community.particle.io/t/platform-id-values-for-all-particle-products/64821 "2023-06-25T10:10:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![markwkiehl](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/markwkiehl/32/23561_2.png) [@markwkiehl](https://community.particle.io/u/markwkiehl)\
**Post date:** [June 25, 2023, 10:10am UTC](https://community.particle.io/t/platform-id-values-for-all-particle-products/64821/1 "2023-06-25T10:10:24Z")

</div>

I need the PLATFORM\_ID for the following Particle products: Tracker One, Tracker SOM, B Series SOM, Photon 2, P2, Photon, Electron, and E Series. I want to use it to differentiate between those products that have a built-in LED on D7, and those that do not.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [June 25, 2023, 10:18am UTC](https://community.particle.io/t/platform-id-values-for-all-particle-products/64821/2 "2023-06-25T10:18:18Z")

</div>

For the current devices

> <https://github.com/particle-iot/device-os/blob/86bc4a684d8f072b4cf881dfc618544b777a83a7/hal/shared/platforms.h#L27>

for legacy devices you'd need to check a previous repo version

> <https://github.com/particle-iot/device-os/blob/v3.2.0/hal/shared/platforms.h#L27>

---

<div class="post-metadata">

**Author:** ![markwkiehl](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/markwkiehl/32/23561_2.png) [@markwkiehl](https://community.particle.io/u/markwkiehl)\
**Post date:** [June 25, 2023, 1:36pm UTC](https://community.particle.io/t/platform-id-values-for-all-particle-products/64821/3 "2023-06-25T13:36:24Z")

</div>

Will the following function accurately differentiate products (Boron, Argon, Photon 2, Photon, Electron, Core) with the built-in LED on D7?

```auto
bool deviceHasLedOnD7() {
  // Returns TRUE if the device has a built-in LED on D7:
  // Boron, Argon, Photon 2, Photon, Electron, Core
  // 8: P1
  switch (PLATFORM_ID) {
    case PLATFORM_BORON:
      return TRUE;
    case PLATFORM_ARGON:
      return TRUE;
    case 0:
      // Core
      return TRUE;
    case 6:
      // Photon (PLATFORM_PHOTON_PRODUCTION)
      return TRUE;
    case 10:
      // Electron (PLATFORM_ELECTRON_PRODUCTION)
      return TRUE;
    default:
      return FALSE;
  }
} // deviceHasLedOnD7()

```

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [June 25, 2023, 4:20pm UTC](https://community.particle.io/t/platform-id-values-for-all-particle-products/64821/4 "2023-06-25T16:20:00Z")

</div>

I'd think so - although with fall-through it can be written shorter

```cpp
bool deviceHasLedOnD7() {
  // Returns TRUE if the device has a built-in LED on D7:
  // Boron, Argon, Photon 2, Photon, Electron, Core
  // 8: P1
  switch (PLATFORM_ID) {
    case 0: // Core
    case PLATFORM_PHOTON_PRODUCTION:
    case PLATFORM_ELECTRON_PRODUCTION:
    case PLATFORM_ARGON:
    case PLATFORM_BORON:
      return TRUE;
    default:
      return FALSE;
  }
} // deviceHasLedOnD7()

```

---

<div class="post-metadata">

**Author:** ![armor](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/armor/32/18398_2.png) [@armor](https://community.particle.io/u/armor)\
**Post date:** [June 26, 2023, 11:58am UTC](https://community.particle.io/t/platform-id-values-for-all-particle-products/64821/5 "2023-06-26T11:58:10Z")

</div>

What about Photon2 value in switch case?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/6/4/64635adccc35238caa19e9b553ec3e98b163d026.png) [@system](https://community.particle.io/u/system)\
**Post date:** [July 26, 2023, 9:59pm UTC](https://community.particle.io/t/platform-id-values-for-all-particle-products/64821/6 "2023-07-26T21:59:06Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
