# Send 3 variable to Arduino?

**URL:** <https://discourse.processing.org/t/send-3-variable-to-arduino/5467>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [November 12, 2018, 10:24am UTC](https://discourse.processing.org/t/send-3-variable-to-arduino/5467 "2018-11-12T10:24:20Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![bking](https://avatars.discourse-cdn.com/v4/letter/b/dc4da7/32.png) [@bking](https://discourse.processing.org/u/bking)\
**Post date:** [November 16, 2018, 12:00pm UTC](https://discourse.processing.org/t/send-3-variable-to-arduino/5467/13 "2018-11-16T12:00:48Z")

</div>

Hi,

Finally, I can receive my 3 variables in Arduino just by making exactly what jb4x said in his first post!!! (changing the speed of connection, use recevieData…)

see the Arduino Code below

```auto
    Setpoint = 0;
     stateB= 0;
     stateD= 0; 
  
}
 
void loop() {

   // read the sensor value: (the potar)
  // int sensorReading = analogRead(A0);

   // send sensorReading to Serial (to receive it in Processing)
   //Serial.print(analogRead(sensorReading));   
  
  
   // _____________________________________________
   // see if there's incoming serial data: (from processing)
  receiveData();
   

     Setpoint = map( w1, 0,255, -100,100); //1er
     stateB= map( w2, 0,200, -100,100);
     stateD= map( phiV, 0,255, -100,100); // 3eme
   
 // Serial.print ("Setpoint :"); Serial.println (Setpoint); we can't see Setpoint when Processing works because the Serial is busy

void receiveData() {
  
  if (Serial.available() > 0) {
    w1= Serial.parseInt();
    w2 = Serial.parseInt();
    phiV = Serial.parseInt();
    Serial.read();
  }
  }

```

in processing there is no effect if I do this

// arduinoport.write(values[0] + “;” + values[2] + “;” + values[1] + “;”);  
arduinoport.write(values[1] + " " + values[2] + " " + values[0] + " ");

To finish I want to send one or several value from Arduino to Processing with the same both program.

I’ll come back if I have any problem.

Thanks Jb4x to be patient, your project [A universal ambilight](https://discourse.processing.org/t/a-universal-ambilight/1962) looks pretty good and useful to learn making nice project.

Thanks to M. [Whahahahaha](https://discourse.processing.org/u/Whahahahaha)

---

_[View the full topic](https://discourse.processing.org/t/send-3-variable-to-arduino/5467)._
