Help needed with my code to actually run

Hello everyone.

So i have this code for a smart parking system, i got from a video on youtube How to make a Automatic Car Parking System - YouTube and in the video the guy uses i2c lcd converter to lower his pins but i don't have that so i edited the code a bit and when i tried to simulate on tinkard.com the counter doesn't work properly, is it because i have the used the analog pins for the gate sensors or it might be something else?

This is the code, any help would be appreciated, need confirmation that this would work properly or where did i make a mistake?

 #include <Servo.h>
Servo myservo;

int y = 0;
#include <LiquidCrystal.h>
const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

const int place[] = {13, 12, 11, 10, 9};
byte val[6];
const int in    = A1;
const int out   = A2;
int count = 0;
int valin = 0;
int valout = 0;
int pos = 0;
int cnt;
void setup() {
  Serial.begin(9600);
  for (int i = 0; i < 5; i++)
  {
    pinMode(place[i], INPUT);
  }

  pinMode(in, INPUT);
  pinMode(out, INPUT);

  myservo.attach(A0);

  lcd.begin(16, 2);

  lcd.setCursor(0, 0);
  lcd.print("Hello everyone");

  myservo.write(0);

  for (pos = 0; pos <= 40; pos += 1) {
    myservo.write(pos);
    delay(30);
  }
  delay(1000);
  for (pos = 40; pos >= 0; pos -= 1) {
    myservo.write(pos);
    delay(30);
  }
  lcd.clear();
  lcd.setCursor(0, 0);
  count = 0;
}

void loop() {
  //*******************************************************
  lcd.setCursor(0, 0);
  lcd.print("P-L:");
  lcd.setCursor(0, 1);
  for ( y = 0; y < 5; y++)
  {
    val[y] = digitalRead(place[y]);
    if (val[y] == 1) {
      lcd.print(y + 1);
    }
  }

  lcd.print("       ");
  valin = digitalRead(in);
  valout = digitalRead(out);

  if (count >= 6) {
    count = 6; myservo.write(0); delay(1000); myservo.detach();
    lcd.setCursor(5, 1);
    lcd.print("       full");
  }

  //********************************************************
  if (valout == LOW) {


    for (pos = 0; pos <= 40; pos += 1) {
      myservo.write(pos);
      delay(30);
    }

    while (valout == LOW) {
      valout = digitalRead(out);
    }
    count++;

    if (count < 7) { }

    delay(1000);
    for (pos = 40; pos >= 0; pos -= 1) {
      myservo.write(pos);
      delay(30);
    }
  }
  //********************************************************
  if (valin == LOW) {

    myservo.attach(A0);
    for (pos = 0; pos <= 40; pos += 1) {
      myservo.write(pos);
      delay(30);
    }

    while (valin == LOW) {
      valin = digitalRead(in);
    }
    count--;

    if (count <= 0) {
      count = 0;
    }

    delay(1000);
    for (pos = 40; pos >= 0; pos -= 1) {
      myservo.write(pos);
      delay(30);
    }
  }
  //********************************************************
  lcd.setCursor(10, 1);
  lcd.print(" cnt:");
  lcd.print(count);
  if (count >= 6) {
    lcd.setCursor(5, 1);
    lcd.print("       full   ");
  }

}

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup (thus the italics in your code above), leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

TarekSmaili:
it doesn't run with a problem for the outside sensors that open the servo motor

That's not a good enough description of the problem. Try again.

pert:
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup (thus the italics in your code above), leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.
That's not a good enough description of the problem. Try again.

Thank you a lot mate

TarekSmaili:
so i edited the code a bit and when i tried to simulate on tinkard.com the counter doesn't work properly

That is still not an adequate description of the problem. Do you get anything on the LCD? Does it count backwards or skip numbers or something?

Use the real thing instead of a simulator. With a simulator, if it works, great; if it does not work, you do not know if it's your code or the simulator.