# Problem with values

**URL:** <https://discourse.processing.org/t/problem-with-values/34578>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [January 11, 2022, 3:17pm UTC](https://discourse.processing.org/t/problem-with-values/34578 "2022-01-11T15:17:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SNIMNS](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@SNIMNS](https://discourse.processing.org/u/SNIMNS)\
**Post date:** [January 11, 2022, 3:17pm UTC](https://discourse.processing.org/t/problem-with-values/34578/1 "2022-01-11T15:17:00Z")

</div>

I have a problem

When i put the last if (watch the next code) the program not return others values and stop all

How can i solve it?

```auto
//Istruzioni per la futura connessione con la seriale
import processing.serial.*;
Serial myPort;
String portName;

//Istanziamento oggetti dalle classi
Schermata schermo;
Ricezione valueArduino;
Button onWater;
Button offWater;
Button onFan;
Button offFan;

//Valoriabili per valori letti dalla seriale di Arduino
int levelwater;
int soilmoisture;
int temperature;
int moisture;

//Variabili per valori di soglia
int soglialevel = 10;
int sogliasoil = 80;
int sogliatemp = 17;
int sogliamoisture = 80;

void setup(){
  
  //Inizializzazione nuova schermata
  size(900, 600);
  schermo = new Schermata();
  
  //Comunicazione seriale
  portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600); 
  
  //Dati da Arduino
  valueArduino = new Ricezione();
  
  //Pulsanti di controllo
  onWater = new Button(30, 200, 100, 100, "ON", 153, 153, 0, 25, -15);
  offWater = new Button(170, 200, 100, 100, "OFF", 153, 153, 0, 35, -15);
  onFan = new Button(30, 420, 100, 100, "ON", 153, 153, 0, 25, -15);
  offFan = new Button(170, 420, 100, 100, "OFF", 153, 153, 0, 35, -15);
  
}

void draw(){
  
  //Schermo in loop, perché altrimenti si sovrapporrebbero i valori
  schermo = new Schermata();
  
  //Passaggio dei valori letti dalla seriale
  levelwater = valueArduino.backLevel();
  soilmoisture = valueArduino.backSoil();
  temperature = valueArduino.backTemperature();
  moisture = valueArduino.backMoisture();
  
  //Valori da Arduino
  valueArduino.Print();
  delay(100);
  
  //Funzionamento pulsanti
  onWater.render();
  offWater.render();
  onFan.render();
  offFan.render();
  onWater.uptade();
  offWater.uptade();
  onFan.uptade();
  offFan.uptade();
    
  //Funzionamento per i pulsanti
  if(onWater.isClicked()){
  
    myPort.write("P1 1\n");
    onWater.Clicked = false;
    
  }
    
  if(offWater.isClicked()){
    
    myPort.write("P1 2\n");
    offWater.Clicked = false;
      
  }
    
  if(onFan.isClicked()){
  
    myPort.write("F1 3\n");
    onFan.Clicked = false;
    
  }
    
  if(offFan.isClicked()){
    
    myPort.write("F1 4\n");
    offFan.Clicked = false;
      
  }
  
  if(levelwater < soglialevel){
    
    myPort.write("P1 2\n");
  
  }
  
}

```

Please help me…

---

<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 12, 2022, 8:13pm UTC](https://discourse.processing.org/t/problem-with-values/34578/2 "2022-01-12T20:13:23Z")

</div>

Hi @SNIMNS I speak a little Italian which helps with your variable names, but that’s not the problem. I think you must have other tabs in the IDE. I need the definition of Schermata() Ricezione() and a few more. Can you post the contents of each tab please (per favor)?
