sscanf(); help SD CARD

Arduino Code

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


byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 150); // IP address, may need to change depending on network
EthernetServer server(80);  // create a server at port 80

#define REQ_BUF_SZ   100
char HTTP_req[REQ_BUF_SZ] = {0}; // buffered HTTP req

int sensorPin = 0;
int sar[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int tur = 0;
int yuva = 0;
int i = 0;
int deger = 0;
int x = 0;
File webFile;

void setup() {
  // put your setup code here, to run once:
  pinMode(3, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);




  Ethernet.begin(mac, ip);
  server.begin();
  Serial.begin(9600);

  Serial.println("Initializing SD card...");
  if (!SD.begin(4)) {
    Serial.println("ERROR - SD card initialization failed!");
    return;    // init failed
  }
  Serial.println("SUCCESS - SD card initialized.");
  // check for index.htm file
  if (!SD.exists("index.htm")) {
    Serial.println("ERROR - Can't find index.htm file!");
    return;  // can't find index file
  }
  Serial.println("SUCCESS - Found index.htm file.");

}

void loop() {
  // put your main code here, to run repeatedly:
  EthernetClient client = server.available();  // try to get client

  if (client) {  // got client?
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {   // client data available to read
        char c = client.read(); // read 1 byte (character) from client
        // last line of client request is blank and ends with n
        // respond to client only after last line received
        if (c == 'n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");
          client.println();
          // send web page
          webFile = SD.open("index.htm");        // open web page file
          if (webFile) {
            while (webFile.available()) {
              client.write(webFile.read());
              // send web page to client
            }
            webFile.close();
          }
          break;
        }
        // every line of text received from the client ends with rn
        if (c == 'n') {
          // last character on line of received text
          // starting new line with next character read
          currentLineIsBlank = true;
        }
        else if (c != 'r') {
          // a text character was received from client
          currentLineIsBlank = false;
        }
      } // end if (client.available())
    } // end while (client.connected())
    delay(1);      // give the web browser time to receive the data
    client.stop(); // close the connection
  } // end if (client)

  int x = sscanf(HTTP_req, "sar1=%ld&sar2=%ld&sar3=%ld&sar4=%ld&sar5=%ld&sar6=%ld&sar7=%ld&sar8=%ld&sar9=%ld&sar10=%ld", &sar[0], &sar[1], &sar[2], &sar[3], &sar[4], &sar[5], &sar[6], &sar[7], &sar[8], &sar[9]);

  digitalWrite(7, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);//Yuva Degistirme Motoru
  digitalWrite(3, HIGH);//Hareket Lambası sönük


  if (x > 1)
  {
    digitalWrite(7, LOW); //ASenkron Motor Çalıştırdık
    delay(1000);
    if (sar[i] == 0)
    {
      yuvadegistir();
    }
    else if (yuva == 10)
    {
      bitir();
    }
    else if (sar[i] > 0)
    {
      calistir();
    }
    yuvadegistir();

  }
  else
  {
    Serial.println("Sarım Bilgileri Gelmedi");
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(7 , HIGH);
    delay(0);
  }
}
void yuvadegistir(void)
{
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(3, HIGH);
  digitalWrite(7, HIGH);
  Serial.print(yuva + 1);
  Serial.println(" Yuva Degistiriliyor");
  tur = 0;
  delay(15000);
  digitalWrite(6, HIGH);
  digitalWrite(7, LOW);
  yuva++;
}
void bitir(void)
{
  Serial.println("Sarim Bitti");
  digitalWrite(3, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(6, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(4, HIGH);
  delay(10000);
}
void calistir(void)
{
  while (sar[i] > tur)
  {
    deger = analogRead(sensorPin);
    if (deger > 250 && deger < 350) //Hareket Var MI Yok Mu
    {
      digitalWrite(6, HIGH);
      digitalWrite(3, LOW);
      Serial.print(tur + 1);
      Serial.println("Tur");
      digitalWrite(3, HIGH);
      delay(1200);
    }
    else
    {
      Serial.println("Hareket Yok");
      delay(1200);
    }
    tur++;

  }
  i++;
}

Web Page

http://mucahitgunay.com.tr/arduino/index.htm

Was there a question to go with that?

to sar[7] :frowning:

int x = sscanf(HTTP_req, “sar1=%ld&sar2=%ld&sar3=%ld&sar4=%ld&sar5=%ld&sar6=%ld&sar7=%ld&sar8=%ld&sar9=%ld&sar10=%ld”, &sar[0], &sar[1], &sar[2], &sar[3], &sar[4], &sar[5], &sar[6], &sar[7], &sar[8], &sar[9]);

Problem :frowning:

When pressed, the button will send the Arduino Text Value