Control led from JSP program in Apache Tomcat server

i’m trying to send measured data at Arduino to JSP (using Eclipse and Apache Tomcat server) using HTTP GET and server send control LED signal values to the Arduino at the same time .

There is no compile error
but led control doesn’t work
the problem is that i don’t know what is the problem…

here is the code

#include <SPI.h>
#include <Ethernet.h>

  IPAddress serverName(192, 168, 21, 6); 
  IPAddress ip(192, 168, 21, 11);
  EthernetServer server(80);
  EthernetClient client;
  byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
  
  boolean incoming = 0;
  String readString;
  
  int val1=analogRead(0);
 //int val2=analogRead(1);
  int val2=0;
  
void setup() {
  pinMode(13, OUTPUT);
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.begin(9600);
}

void loop() {
  unsigned long prevMillis = 0;
  unsigned long currentMillis = millis(); 
  if(currentMillis - prevMillis >= 1000){ 
    prevMillis = currentMillis;
    
    sendGET(); // call client sendGET function
  }
  
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        
        if (incoming && c == ' ') {
          incoming = 0;
        }
        
        if (c == '

Ps : I’m not good at English, so i used google translator
I would greatly appreciate it if you kindly give me some help :sweat_smile:) {
          incoming = 1;
        } */

if (incoming == 1) {
          Serial.println(c);

if (c == ‘1’) {
            Serial.println(“ON”);
            digitalWrite(13, HIGH);
          }
          if (c == ‘2’) {
            Serial.println(“OFF”);
            digitalWrite(13, LOW);
          }

}
      }
    }
    client.stop();
  }
}

void sendGET() //client function to send and receive GET data from external server.
{
   
    if (Ethernet.begin(mac) == 0) {
      Ethernet.begin(mac, ip);
    }
 
    if (client.connect(serverName, 8080)) {
      client.print(“GET /FloorNoise/FloorNoiseMain.jsp?val=”);
      client.print(val1);
      client.print("&vive=");
      client.print(val2);
      client.println("&adr=106-301");
      client.println();
    } else {
      Serial.println(“connection failed”);
    }

client.stop();

}


Ps : I'm not good at English,, so i used google translator
I would greatly appreciate it if you kindly give me some help :sweat_smile:

How do you know the LED is not working? What is it suppose to do?

If you are using an Uno, the LED is not working. Digital pins 10 to 13 are used by the SPI bus. You can't use the LED on D13 because it is the SPI clock line.