Parking Lot

Hi, I have a problem with my parking lot and I cant fix it, im a new user on Arduino and in programming aswell so I hope that someone could help me please.
My parking lot is composed by 2 Servos ( one servo for the entry of the park and the other one for the out part), 2 IR sensors and 1 LCD 16x2 I2C.
When the cars pass the sensors it will activate the servo that works like a barrier of a irl parking lot and the car will pass, the park has 6 spots. My Problem is that I wanted to make the servo stoped and a message would appear on the LCD that the park is full but I cant do that so I hope that someone could help me.
Sorry for my bad english, tell me anything you need if you dont understand someting :).

Il leave here the program I have so far.

Parque_de_Estacionamento_Automatizado_v5.ino (1.98 KB)

What did you try?

if (contlugares == 0)

Your code will work, but it would generally be considered bad practice to try maintain two variables with opposite meanings...


Too much chance you may forget to adjust one, and then they would be "out of step" with each other.

const int totalSpaces = 6;
int spacesUsed = 0;

//Car in...
//Car out...

//Display spaces remaining
 lcd.print(totalSpaces  - spacesUsed);

//If car park full...
if (spacesUsed == totalSpaces)