Flag for Running Pi?

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

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

You could get the OS. Check these links:



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

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! :slight_smile:


1 Like