# Flag for Running Pi?

**URL:** https://discourse.processing.org/t/flag-for-running-pi/2087
**Category:** Processing for Pi
**Created:** [July 26, 2018, 12:22am UTC](https://discourse.processing.org/t/flag-for-running-pi/2087 "2018-07-26T00:22:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![robotgrrl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/robotgrrl/32/935_2.png) [@robotgrrl](https://discourse.processing.org/u/robotgrrl)
#### Post date: [July 26, 2018, 12:22am UTC](https://discourse.processing.org/t/flag-for-running-pi/2087/1 "2018-07-26T00:22:09Z")

</div>

Is there a “flag” that we could use in our code to check if a sketch is running on a Pi? For example

```auto
if(RASPI == true) { 
// do our pi code
}

```

I’m using the Upload to Pi tool, so ideally this flag could be set automatically rather than having to change the code manually each time

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [July 26, 2018, 1:49am UTC](https://discourse.processing.org/t/flag-for-running-pi/2087/2 "2018-07-26T01:49:04Z")

</div>

You could get the OS. Check these links:

> [https://forum.processing.org/two/discussion/6862/system-specs](https://forum.processing.org/two/discussion/6862/system-specs)  
> [https://www.mkyong.com/java/how-to-detect-os-in-java-systemgetpropertyosname/](https://www.mkyong.com/java/how-to-detect-os-in-java-systemgetpropertyosname/)  
> [The ideal way to detect a raspberry pi from java (jar) - Stack Overflow](https://stackoverflow.com/questions/37053271/the-ideal-way-to-detect-a-raspberry-pi-from-java-jar)

Kf

---

<div class="post-metadata">

### Author: ![gohai](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gohai/32/25_2.png) [@gohai](https://discourse.processing.org/u/gohai)
#### Post date: [July 26, 2018, 2:44am UTC](https://discourse.processing.org/t/flag-for-running-pi/2087/3 "2018-07-26T02:44:27Z")

</div>

@robotgrrl There are ways to do this, e.g. by doing

```auto
if ("arm".equals(System.getProperty("os.arch"))) {
  // ...
}

```

But more generally I’d be curious to learn which parts of your code need changing when you go from one to the other! 🙂

Hth
