# After testing on x86 PC exported arm64 program does not run on Pi 4

**URL:** <https://discourse.processing.org/t/after-testing-on-x86-pc-exported-arm64-program-does-not-run-on-pi-4/34635>\
**Category:** Processing for Pi\
**Created:** [January 15, 2022, 8:05am UTC](https://discourse.processing.org/t/after-testing-on-x86-pc-exported-arm64-program-does-not-run-on-pi-4/34635 "2022-01-15T08:05:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajiv.tctech](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rajiv.tctech](https://discourse.processing.org/u/rajiv.tctech)\
**Post date:** [January 15, 2022, 8:05am UTC](https://discourse.processing.org/t/after-testing-on-x86-pc-exported-arm64-program-does-not-run-on-pi-4/34635/1 "2022-01-15T08:05:01Z")

</div>

I have a program written in Processing 3.x, which I have tested on an x86 PC, after exporting the program without bundling Java. The same process also exported an arm64 and armv6hf version. I tested the linux64 version with OpenJDK 11.x on my PC and it works OK.

When I run the arm64 or the armv6hf program on a Raspberry Pi with OpenJDK 11.x installed, my 1000 x 1000 pixel screen opens up but its just blank. I don’t get my graphics, even though the /data folder has the graphics PNG files.

I suspect this has something to do with the serial interface, on which data is streaming in from a data source on a RasPi Pico. But then, on the PC, if there’s a serial interface missing, the Processing program just hangs. On the RasPi 4, the screen is opening up sans graphics but nothing is locking up. So it just could be something else…

Is there a way I can scan the serial interfaces and select an interface programmatically?

My Processing code, Arduino Pico code and graphics files are as under:

 ![Centre_Delhi](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/db866e3c459c8f5193e9cf69e139810f56cd6fc7.png)  
 ![RadarBeam](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/2bed610a64f8ad283a305d70d1cb0722b016855b.png)  
 ![RadarDisplay](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/ca1f4067fd4f22c5a31472070237311f1f532a1f.png)

Processing code:

```auto
import processing.serial.*; //importing serial library 
PImage beam; // to store meter needle image
PImage display; // to store meter image 
PImage mapTile; // store map tile
float increment;
float previousAzimuth = 0;
float currentAzimuth = 0;
float plottedAzimuth;
String azimuthString;
int nl = 10;
int inByte; //to store incomming value from serial port
int reading=0; //to store mapped inByte value
Serial azimuth; //naming our serial port as "arduino"

void setup(){ //only runs one time when program starts
  background(0); //making background color as black
  size(1000, 1000); //output window size 1000 x 1000 pixel
  //fullScreen(); //output window size full screen
  beam=loadImage("RadarBeam.png"); //loading timebase image
  display=loadImage("RadarDisplay.png"); //loading radar rose image
  mapTile=loadImage("Centre_Delhi.png"); //loading map tile
  //beam.resize(66, 66); //resizing needle image to fit our meter
  //printArray(Serial.list()); //listing serial port to find the port in which arduino is connected
  azimuth = new Serial(this, Serial.list()[0], 115200); //initializing port, in my case arduino is no.4 in the list
  
}

void draw(){ //this will loop by 60 frame per second by default , frame rate can be changed by frameRate() function
  if (azimuth.available()>0){ //checking whether there is incomming serial values
    azimuthString = azimuth.readStringUntil(nl);
    if (azimuthString != null){
      currentAzimuth = float(azimuthString);
    }
    //currentAzimuth=azimuth.read(); //storing incoming values to variable inByte
    if (currentAzimuth != previousAzimuth){
      plottedAzimuth = currentAzimuth;
      previousAzimuth = currentAzimuth;
    }
    else{
      plottedAzimuth = previousAzimuth;
    }
  }
  
  imageMode(CENTER); //draw image using center mode
  //image(mapTile, width/2, height/2);
  tint(255,255);
  image(display, width/2, height/2); //drawing meter image
  tint (255,128); //first param is tint color. second param is alpha channel
  image(mapTile, width/2, height/2);
  pushMatrix(); //saving current transformation matrix onto the matrix stack
  imageMode(CORNERS); //draw image using corners mode
  translate((width/2)+0, (height/2)+2); //translating "(width/2)+2, (height/2)+15" to "0,0"
  //rotate(((HALF_PI)-19.69)+ plottedAzimuth); //rotation needle image to position to zero in meter image
  rotate(-(HALF_PI) + radians(currentAzimuth));
  image(beam, 0, 0, 350, 2); //drawing needle image
  popMatrix();//removing the current transformation matrix off the matrix stack
  
  println(currentAzimuth);
}

```

Arduino code:

```auto
int azimuth = 0;

void setup() {
  Serial.begin(115200);
}

void loop() {
  for(int i=0; i<360; i++){
    //Serial.write(i);
    Serial.println(i);
    delayMicroseconds(28000);
  }
}

```

---

<div class="post-metadata">

**Author:** ![RichardDL](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@RichardDL](https://discourse.processing.org/u/RichardDL)\
**Post date:** [January 16, 2022, 7:21pm UTC](https://discourse.processing.org/t/after-testing-on-x86-pc-exported-arm64-program-does-not-run-on-pi-4/34635/2 "2022-01-16T19:21:01Z")

</div>

Hi @rajiv.tctech, I have a sketch that I use on PC and Pi, want to use exactly the same code, so I put the name of the Arduino device COM4 or ttyAMA0 in a data file (ArdPort.dat). Read that with loadStrings at sketch start. On he Pi you could use a bash script file to do ‘ls /dev’, text processing to find the Arduino port name, write that into the dat file, then run the processing sketch. (Might be possible to do all that from within Processing, but I don’t know.)

---

<div class="post-metadata">

**Author:** ![rajiv.tctech](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rajiv.tctech](https://discourse.processing.org/u/rajiv.tctech)\
**Post date:** [January 17, 2022, 9:57am UTC](https://discourse.processing.org/t/after-testing-on-x86-pc-exported-arm64-program-does-not-run-on-pi-4/34635/3 "2022-01-17T09:57:13Z")

</div>

Thanks @RichardDL. Can you share your code here?

---

<div class="post-metadata">

**Author:** ![RichardDL](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@RichardDL](https://discourse.processing.org/u/RichardDL)\
**Post date:** [January 17, 2022, 10:12am UTC](https://discourse.processing.org/t/after-testing-on-x86-pc-exported-arm64-program-does-not-run-on-pi-4/34635/4 "2022-01-17T10:12:59Z")

</div>

The contents of the dat file is simply text (I’d forgotten that I’d put window dimensions in there) :

```auto
PortName,COM9
Width,1500
Height,800

```

And the code to read it:

```auto
String sGetOption(String Option)
{
  /* read through the options file,
  find the one requested,
  return the value */
 
  String[] lines;
  String[] parts;
  String retstr;
 
  int index = 0;

  retstr = "";
  lines = loadStrings("Humidity_Chart.dat");
  for (index = 0; index < lines.length; index++)
  {
    parts = split(lines[index], ',');
    if (parts[0].equals(Option)){retstr = parts[1];}
 }
 
  return retstr;
}

int iGetOption(String Option)
{
    int iRetVal = 0;
    String sRetVal;
    sRetVal = sGetOption(Option);
    if (!sRetVal.equals("")){iRetVal = int(sRetVal);}
    return iRetVal;
}

Setup...
PortName = sGetOption("PortName");

Settings...
int opt_wide = iGetOption("Width");
int opt_hite = iGetOption("Height");

Draw...
(conditional)
myPort = new Serial(this, PortName, 9600);

```

---

<div class="post-metadata">

**Author:** ![rajiv.tctech](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rajiv.tctech](https://discourse.processing.org/u/rajiv.tctech)\
**Post date:** [January 24, 2022, 12:55pm UTC](https://discourse.processing.org/t/after-testing-on-x86-pc-exported-arm64-program-does-not-run-on-pi-4/34635/5 "2022-01-24T12:55:54Z")

</div>

Thank you! It’s a neat solution…
