# Processing Arduino communication

**URL:** <https://discourse.processing.org/t/processing-arduino-communication/38026>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [July 19, 2022, 10:26am UTC](https://discourse.processing.org/t/processing-arduino-communication/38026 "2022-07-19T10:26:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisBon8](https://avatars.discourse-cdn.com/v4/letter/c/9de0a6/32.png) [@chrisBon8](https://discourse.processing.org/u/chrisBon8)\
**Post date:** [July 19, 2022, 10:26am UTC](https://discourse.processing.org/t/processing-arduino-communication/38026/1 "2022-07-19T10:26:39Z")

</div>

Hi everyone, i am working with processing and arduino. I am trying to pass via serial method a String “x;y” where x and y are integers from arduino to Processing. Then i want to plot on processing the x and y separately, but i can’t accomplish this since y is always zero. Someone can help?

processing:

```auto
Serial myPort; // The serial port
String coor;
int[] x = new int[width];
int[] y = new int[height];
int i = 0;

void setup() {
  // List all the available serial ports:
  printArray(Serial.list());
  // Open the port you are using at the rate you want:
  myPort = new Serial(this, Serial.list()[0], 115200);
  size(600, 600);
  background(255);
}

void draw() {
  while (myPort.available() > 0) {
    String inBuffer = myPort.readString();
    if (inBuffer != null) {
      int[] coor = int(split(inBuffer, ';'));
      x[i] = coor[0];
      y[i] = coor[1];
      println(inBuffer);
      println(coor[1]);
      i++;
    }
  }
}

```

arduino:

```auto
void setup() {
  Serial.begin(115200);
  Serial.println();
}

void loop() {
  int x = random(0, 251);
  int y = random(0, 361);
  Serial.print(x);
  Serial.write(';');
  Serial.println(y);
  delay(1000);
}

```

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 19, 2022, 11:04am UTC](https://discourse.processing.org/t/processing-arduino-communication/38026/2 "2022-07-19T11:04:50Z")

</div>

Hello @chrisBon8 ,

You are missing:

`import processing.serial.*;`

This will work and was tested:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/a/1af3f159aa7e642cc9b2033d792d7e64815a08f9.png)

Look up the references.

Also take a look at:  
[https://www.arduino.cc/reference/en/language/functions/communication/serial/println/](https://www.arduino.cc/reference/en/language/functions/communication/serial/println/)

`:)`
