# How send multiple values from Processing to Arduino

**URL:** https://discourse.processing.org/t/how-send-multiple-values-from-processing-to-arduino/36167
**Category:** Electronics (Arduino, etc.)
**Created:** [April 6, 2022, 4:17pm UTC](https://discourse.processing.org/t/how-send-multiple-values-from-processing-to-arduino/36167 "2022-04-06T16:17:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yohan](https://avatars.discourse-cdn.com/v4/letter/y/e99b99/32.png) [@yohan](https://discourse.processing.org/u/yohan)
#### Post date: [April 6, 2022, 4:17pm UTC](https://discourse.processing.org/t/how-send-multiple-values-from-processing-to-arduino/36167/1 "2022-04-06T16:17:43Z")

</div>

I’m using shiftr to receive data into processing and I want to send it to Arduino. I’ve stored 8 values into an array and sent it to Arduino as a string. I’m having trouble with receiving the string in Arduino from processing and storing it into 8 separate values to use with a sensor.  
each value is a 1 or 0

processing code:

```auto
void draw() {
  background(0);
  int[] touchSensor = new int[8];
  touchSensor[0]= Jtouch1;
  touchSensor[1]= Jtouch2;
  touchSensor[2]= AAtouch1;
  touchSensor[3]= AAtouch2;
  touchSensor[4]= ARtouch1;
  touchSensor[5]= ARtouch2;
  touchSensor[6]= Ttouch1;
  touchSensor[7]= Ttouch2;

   String theStg = "<" + nf(touchSensor[0], 1) +
   " " + nf(touchSensor[1], 1) +
   " " + nf(touchSensor[2], 1) +
   " " + nf(touchSensor[3], 1) +
   " " + nf(touchSensor[4], 1) +
   " " + nf(touchSensor[5], 1) +
   " " + nf(touchSensor[6], 1) +
   " " + nf(touchSensor[7], 1) +
   ">";
   myPort.write(theStg);

}

```

---

<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: [April 7, 2022, 2:30am UTC](https://discourse.processing.org/t/how-send-multiple-values-from-processing-to-arduino/36167/2 "2022-04-07T02:30:33Z")

</div>

> [@yohan](#):
>
> I’m having trouble with receiving the string in Arduino from processing and storing it into 8 separate values to use with a sensor.  
> each value is a 1 or 0

Hello,

Here are some resources:

[https://forum.arduino.cc/t/serial-input-basics-updated/382007](https://forum.arduino.cc/t/serial-input-basics-updated/382007)  
[http://www.martyncurrey.com/arduino-serial-part-1/](http://www.martyncurrey.com/arduino-serial-part-1/) \< 4 Parts to this!

`:)`

---

<div class="post-metadata">

### Author: ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)
#### Post date: [April 7, 2022, 7:36am UTC](https://discourse.processing.org/t/how-send-multiple-values-from-processing-to-arduino/36167/3 "2022-04-07T07:36:33Z")

</div>

There is also these very handy library : [VSync](https://github.com/ernestum/VSync)

---

<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: [April 8, 2022, 3:51pm UTC](https://discourse.processing.org/t/how-send-multiple-values-from-processing-to-arduino/36167/4 "2022-04-08T15:51:33Z")

</div>

Hi @yohan, One of the fun parts of Serial Comms to Ard is trying to see or imagine what Ard is doing with the string you’ve given it. Various techniques:

Make your Processing sketch print the string. Now save it as text and stop Processing. In Ard IDE, Serial Monitor, paste in the string and enter. Now you can use print statements in the Ard sketch and see what’s happening.

Which Ard are you using? Some have extra serial ports where you could print progress messages and view them via TTL to USB adaptor. You could use OLED or LCD screens.

You could post your Ard sketch. (And the Processing string you’re sending.)
