Problem with code or compiler

Can someone explain why the compiler cannot read this code

Car_Parking_System.ino (1.2 KB)

Please post the code here using code tags when you do. See How to get the best out of this forum

What do you mean exactly when you say that the compiler cannot read the code ? Do you get any error messages ?

Why did you open another topic to post the code ?

Post it here and use code tags when you do

The duplicate topic has been deleted

How is this a bootloader issue?

I have left the topic where it is until we have a better description of the problem

I've taken your code, changed the I2C LCD to a normal one (as I don't know which LiquidCrystal_I2C you're using) and it compiles without problems.

I will echo post #2 by @UKHeliBob that you should provide the details of what is happening.

Thank you, can you tell me which software you installed to make LCD devices work. .


As said, I just changed to the standard LiquidCrystal library as I don't have your LiquidCrystal_I2C library installed. You have to tell us which LiquidCrystal_I2C library you have installed; there are too many different ones. Is your code based on the examples that come with the library?

We also need to know the errors that you get. When (compile) errors happen, there is a button "copy error messages" in the orange bar; click it to copy the errors to the clipboard and next paste it ere in a reply.

And we like to see the code in a post (with code tags, the </> button above the reply box), not as an attachment.

// Viral Science
// Arduino Car Parking System

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); //Change the HEX address
#include <Servo.h>

Servo myservo1;

int IR1 = 2;
int IR2 = 4;

int Slot = 5; //Enter Total number of parking Slots

int flag1 = 0;
int flag2 = 0;

void setup() {
pinMode(IR1, INPUT);
pinMode(IR2, INPUT);


lcd.setCursor (0,0);
lcd.print(" ARDUINO ");
lcd.setCursor (0,1);
lcd.print(" PARKING SYSTEM ");
delay (2000);

void loop(){

if(digitalRead (IR1) == LOW && flag1==0){
if(flag2==0){myservo1.write(0); Slot = Slot-1;}
lcd.setCursor (0,0);
lcd.print(" SORRY :frowning: ");
lcd.setCursor (0,1);
lcd.print(" Parking Full ");
delay (3000);

if(digitalRead (IR2) == LOW && flag2==0){flag2=1;
if(flag1==0){myservo1.write(0); Slot = Slot+1;}

if(flag1==1 && flag2==1){
delay (1000);
flag1=0, flag2=0;

lcd.setCursor (0,0);
lcd.print(" WELCOME! ");
lcd.setCursor (0,1);
lcd.print("Slot Left: ");

//The code is compiling and uploading okay, but it is alternating between line 43, 44, 45, "sorry parking full" and line 62, 63, 64, "welcome slot left 1" on the LCD display. When I reset, I got "Arduino Parking System" then it count-down from 4 to 1 and start to alternate between the lines mentioned earlier.


@gamalmot - thank you for posting your code but why did you ignore the advice to use code tags when doing so ?

OK, so totally different problem that has definitely nothing to do with Avrdude, stk500 or Bootloader; moved to a more suitable location on the forum.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.