# Programatically determine device

**URL:** <https://community.particle.io/t/programatically-determine-device/43603>\
**Category:** Firmware\
**Created:** [August 23, 2018, 2:29pm UTC](https://community.particle.io/t/programatically-determine-device/43603 "2018-08-23T14:29:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivoah](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ivoah/32/7201_2.png) [@Ivoah](https://community.particle.io/u/Ivoah)\
**Post date:** [August 23, 2018, 2:29pm UTC](https://community.particle.io/t/programatically-determine-device/43603/1 "2018-08-23T14:29:09Z")

</div>

Is it possible to determine what device a project is compiled for using #defines?  
I have a project that I want to do slightly different things depending on if it’s running on a Photon vs an Electron.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 23, 2018, 2:43pm UTC](https://community.particle.io/t/programatically-determine-device/43603/2 "2018-08-23T14:43:38Z")

</div>

Yes. You can check the PLATFORM\_ID for Photon (6) or Electron (10). However, there are also a set of defines for specific features like whether the device has WiFi or Cellular that are better to use in many cases.

> <https://github.com/particle-iot/firmware/blob/develop/wiring/inc/spark_wiring_platform.h#L45>

You don’t need to include anything special to use the Wiring\_\* defines, they’re included from Particle.h and automatically for .ino files.

---

<div class="post-metadata">

**Author:** ![Ivoah](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ivoah/32/7201_2.png) [@Ivoah](https://community.particle.io/u/Ivoah)\
**Post date:** [August 23, 2018, 2:47pm UTC](https://community.particle.io/t/programatically-determine-device/43603/3 "2018-08-23T14:47:52Z")

</div>

That’s exactly what I need, thanks!
