I keep getting object object

// include the library
#include <LiquidCrystal.h>


// initialize the interface pins LiquidCrystal lcd(2,3,4,5,6,7);
LiquidCrystal lcd(2,3,4,5,6,7);
int s,m,h,a,d,state,state1,state2,dg,cnt;

// the 8 arrays that form each segment of the custom numbers
byte bar1[8] = 
{
        B11100,
        B11110,
        B11110,
        B11110,
        B11110,
        B11110,
        B11110,
        B11100
};
byte bar2[8] =
{
        B00111,
        B01111,
        B01111,
        B01111,
        B01111,
        B01111,
        B01111,
        B00111
};
byte bar3[8] =
{
        B11111,
        B11111,
        B00000,
        B00000,
        B00000,
        B00000,
        B11111,
        B11111
};
byte bar4[8] =
{
        B11110,
        B11100,
        B00000,
        B00000,
        B00000,
        B00000,
        B11000,
        B11100
};
byte bar5[8] =
{
        B01111,
        B00111,
        B00000,
        B00000,
        B00000,
        B00000,
        B00011,
        B00111
};
byte bar6[8] =
{
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B11111,
        B11111
};
byte bar7[8] =
{
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00111,
        B01111
};
byte bar8[8] =
{
        B11111,
        B11111,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000
};



void setup()
{
  // assignes each segment a write number
  lcd.createChar(1,bar1);
  lcd.createChar(2,bar2);
  lcd.createChar(3,bar3);
  lcd.createChar(4,bar4);
  lcd.createChar(5,bar5);
  lcd.createChar(6,bar6);
  lcd.createChar(7,bar7);
  lcd.createChar(8,bar8);
  state=1;
  state1=1;
  state2=1;
  // sets the LCD's rows and colums:
  lcd.begin(16, 2);
  pinMode(8,INPUT_PULLUP);
    pinMode(9,INPUT_PULLUP);
      pinMode(10,INPUT_PULLUP);
  s=0;
  m=0;
   h=0;
a=0;
}

void custom0(int col)
{ // uses segments to build the number 0
  lcd.setCursor(col, 0); 
  lcd.write(2);  
  lcd.write(8); 
  lcd.write(1);
  lcd.setCursor(col, 1); 
  lcd.write(2);  
  lcd.write(6);  
  lcd.write(1);
}

void custom1(int col)
{
  lcd.setCursor(col,0);
  lcd.write(32);
  lcd.write(32);
  lcd.write(1);
  lcd.setCursor(col,1);
  lcd.write(32);
  lcd.write(32);
  lcd.write(1);
}

void custom2(int col)
{
  lcd.setCursor(col,0);
  lcd.write(5);
  lcd.write(3);
  lcd.write(1);
  lcd.setCursor(col, 1);
  lcd.write(2);
  lcd.write(6);
  lcd.write(6);
}

void custom3(int col)
{
  lcd.setCursor(col,0);
  lcd.write(5);
  lcd.write(3);
  lcd.write(1);
  lcd.setCursor(col, 1);
  lcd.write(7);
  lcd.write(6);
  lcd.write(1); 
}

void custom4(int col)
{
  lcd.setCursor(col,0);
  lcd.write(2);
  lcd.write(6);
  lcd.write(1);
  lcd.setCursor(col, 1);
  lcd.write(32);
  lcd.write(32);
  lcd.write(1);
}

void custom5(int col)
{
  lcd.setCursor(col,0);
  lcd.write(2);
  lcd.write(3);
  lcd.write(4);
  lcd.setCursor(col, 1);
  lcd.write(7);
  lcd.write(6);
  lcd.write(1);
}

void custom6(int col)
{
  lcd.setCursor(col,0);
  lcd.write(2);
  lcd.write(3);
  lcd.write(4);
  lcd.setCursor(col, 1);
  lcd.write(2);
  lcd.write(6);
  lcd.write(1);
}

void custom7(int col)
{
  lcd.setCursor(col,0);
  lcd.write(2);
  lcd.write(8);
  lcd.write(1);
  lcd.setCursor(col, 1);
  lcd.write(32);
  lcd.write(32);
  lcd.write(1);
}

void custom8(int col)
{
  lcd.setCursor(col, 0); 
  lcd.write(2);  
  lcd.write(3); 
  lcd.write(1);
  lcd.setCursor(col, 1); 
  lcd.write(2);  
  lcd.write(6);  
  lcd.write(1);
}

void custom9(int col)
{
  lcd.setCursor(col, 0); 
  lcd.write(2);  
  lcd.write(3); 
  lcd.write(1);
  lcd.setCursor(col, 1); 
  lcd.write(7);  
  lcd.write(6);  
  lcd.write(1);
}

void printNumber(int value, int col) {
  if (value == 0) {
    custom0(col);
  } if (value == 1) {
    custom1(col);
  } if (value == 2) {
    custom2(col);
  } if (value == 3) {
    custom3(col);
  } if (value == 4) {
    custom4(col);
  } if (value == 5) {
    custom5(col);
  } if (value == 6) {
    custom6(col);
  } if (value == 7) {
    custom7(col);
  } if (value == 8) {
    custom8(col);
  } if (value == 9) {
    custom9(col);
  }      
}  


  
 
 
  
 




void loop()

{
  if(!digitalRead(8)&state==1){
    cnt++;
    state=0;
    if(cnt>3){
      cnt=0;
      }
    }else if(digitalRead(8)&state==0){
    state=1;
    }

if(!digitalRead(9)&&state1==1){
    dg=1;
    state1=0;
     
    }else if(digitalRead(9)&state1==0){
    state1=1;
    }

if(!digitalRead(10)&&state2==1){
     dg=-1;
     state2=0;
    }else if(digitalRead(10)&state2==0){
    state2=1;
    }
    switch(cnt){
      case 1:
      m=m+dg;
      dg=0;  if(m>59){
    m=59;}
    if(m<0){
    m=0;}
      break;
     
      case 2:
      h=h+dg;
      dg=0;if(h>11){
    h=11;}
    if(h<0){
    h=0;}
      break;
          case 3:
     if(dg==1){
    a=1;
    dg=0;}
     if(dg==-1){
    a=0;
    dg=0;}
      break;
      }
  if(s>59){
    s=0;
    m++;
  
  if(m>59){
    m=0;
   h++;
  
  if(h>11){
    h=0;
    a=!a;
  } 
  }
  }
  d=h%10;
  printNumber(d, 3);
  d=h/10;
   printNumber(d, 0);

       d=m%10;
     printNumber(d, 10);
     d=m/10;
     printNumber(d, 7);
     lcd.setCursor(14, 0);
     if(a){
       lcd.print("AM");
      }else{
         lcd.print("PM");
        }
        if(cnt==0){
           s++;
          lcd.setCursor(6, 0);
      lcd.print(" ");
       lcd.setCursor(6, 1);
      lcd.print(" ");
      delay(500);
    lcd.setCursor(6, 0);
      lcd.print(".");
       lcd.setCursor(6, 1);
      lcd.print(".");
      delay(500);
       }
      
   
   


}

moderator edit: code tags added

Sorry but I am kinda new here, I keep getting object object while tring to upload my code, can anyone help?

Thank you
Guy
Here is my code

// include the library
#include <LiquidCrystal.h>


// initialize the interface pins LiquidCrystal lcd(2,3,4,5,6,7);
LiquidCrystal lcd(2,3,4,5,6,7);
int s,m,h,a,d,state,state1,state2,dg,cnt;

// the 8 arrays that form each segment of the custom numbers
byte bar1[8] = 
{
        B11100,
        B11110,
        B11110,
        B11110,
        B11110,
        B11110,
        B11110,
        B11100
};
byte bar2[8] =
{
        B00111,
        B01111,
        B01111,
        B01111,
        B01111,
        B01111,
        B01111,
        B00111
};
byte bar3[8] =
{
        B11111,
        B11111,
        B00000,
        B00000,
        B00000,
        B00000,
        B11111,
        B11111
};
byte bar4[8] =
{
        B11110,
        B11100,
        B00000,
        B00000,
        B00000,
        B00000,
        B11000,
        B11100
};
byte bar5[8] =
{
        B01111,
        B00111,
        B00000,
        B00000,
        B00000,
        B00000,
        B00011,
        B00111
};
byte bar6[8] =
{
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B11111,
        B11111
};
byte bar7[8] =
{
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00111,
        B01111
};
byte bar8[8] =
{
        B11111,
        B11111,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000
};



void setup()
{
  // assignes each segment a write number
  lcd.createChar(1,bar1);
  lcd.createChar(2,bar2);
  lcd.createChar(3,bar3);
  lcd.createChar(4,bar4);
  lcd.createChar(5,bar5);
  lcd.createChar(6,bar6);
  lcd.createChar(7,bar7);
  lcd.createChar(8,bar8);
  state=1;
  state1=1;
  state2=1;
  // sets the LCD's rows and colums:
  lcd.begin(16, 2);
  pinMode(8,INPUT_PULLUP);
    pinMode(9,INPUT_PULLUP);
      pinMode(10,INPUT_PULLUP);
  s=0;
  m=0;
   h=0;
a=0;
}

void custom0(int col)
{ // uses segments to build the number 0
  lcd.setCursor(col, 0); 
  lcd.write(2);  
  lcd.write(8); 
  lcd.write(1);
  lcd.setCursor(col, 1); 
  lcd.write(2);  
  lcd.write(6);  
  lcd.write(1);
}

void custom1(int col)
{
  lcd.setCursor(col,0);
  lcd.write(32);
  lcd.write(32);
  lcd.write(1);
  lcd.setCursor(col,1);
  lcd.write(32);
  lcd.write(32);
  lcd.write(1);
}

void custom2(int col)
{
  lcd.setCursor(col,0);
  lcd.write(5);
  lcd.write(3);
  lcd.write(1);
  lcd.setCursor(col, 1);
  lcd.write(2);
  lcd.write(6);
  lcd.write(6);
}

void custom3(int col)
{
  lcd.setCursor(col,0);
  lcd.write(5);
  lcd.write(3);
  lcd.write(1);
  lcd.setCursor(col, 1);
  lcd.write(7);
  lcd.write(6);
  lcd.write(1); 
}

void custom4(int col)
{
  lcd.setCursor(col,0);
  lcd.write(2);
  lcd.write(6);
  lcd.write(1);
  lcd.setCursor(col, 1);
  lcd.write(32);
  lcd.write(32);
  lcd.write(1);
}

void custom5(int col)
{
  lcd.setCursor(col,0);
  lcd.write(2);
  lcd.write(3);
  lcd.write(4);
  lcd.setCursor(col, 1);
  lcd.write(7);
  lcd.write(6);
  lcd.write(1);
}

void custom6(int col)
{
  lcd.setCursor(col,0);
  lcd.write(2);
  lcd.write(3);
  lcd.write(4);
  lcd.setCursor(col, 1);
  lcd.write(2);
  lcd.write(6);
  lcd.write(1);
}

void custom7(int col)
{
  lcd.setCursor(col,0);
  lcd.write(2);
  lcd.write(8);
  lcd.write(1);
  lcd.setCursor(col, 1);
  lcd.write(32);
  lcd.write(32);
  lcd.write(1);
}

void custom8(int col)
{
  lcd.setCursor(col, 0); 
  lcd.write(2);  
  lcd.write(3); 
  lcd.write(1);
  lcd.setCursor(col, 1); 
  lcd.write(2);  
  lcd.write(6);  
  lcd.write(1);
}

void custom9(int col)
{
  lcd.setCursor(col, 0); 
  lcd.write(2);  
  lcd.write(3); 
  lcd.write(1);
  lcd.setCursor(col, 1); 
  lcd.write(7);  
  lcd.write(6);  
  lcd.write(1);
}

void printNumber(int value, int col) {
  if (value == 0) {
    custom0(col);
  } if (value == 1) {
    custom1(col);
  } if (value == 2) {
    custom2(col);
  } if (value == 3) {
    custom3(col);
  } if (value == 4) {
    custom4(col);
  } if (value == 5) {
    custom5(col);
  } if (value == 6) {
    custom6(col);
  } if (value == 7) {
    custom7(col);
  } if (value == 8) {
    custom8(col);
  } if (value == 9) {
    custom9(col);
  }      
}  


  
 
 
  
 




void loop()

{
  if(!digitalRead(8)&state==1){
    cnt++;
    state=0;
    if(cnt>3){
      cnt=0;
      }
    }else if(digitalRead(8)&state==0){
    state=1;
    }

if(!digitalRead(9)&&state1==1){
    dg=1;
    state1=0;
     
    }else if(digitalRead(9)&state1==0){
    state1=1;
    }

if(!digitalRead(10)&&state2==1){
     dg=-1;
     state2=0;
    }else if(digitalRead(10)&state2==0){
    state2=1;
    }
    switch(cnt){
      case 1:
      m=m+dg;
      dg=0;  if(m>59){
    m=59;}
    if(m<0){
    m=0;}
      break;
     
      case 2:
      h=h+dg;
      dg=0;if(h>11){
    h=11;}
    if(h<0){
    h=0;}
      break;
          case 3:
     if(dg==1){
    a=1;
    dg=0;}
     if(dg==-1){
    a=0;
    dg=0;}
      break;
      }
  if(s>59){
    s=0;
    m++;
  
  if(m>59){
    m=0;
   h++;
  
  if(h>11){
    h=0;
    a=!a;
  } 
  }
  }
  d=h%10;
  printNumber(d, 3);
  d=h/10;
   printNumber(d, 0);

       d=m%10;
     printNumber(d, 10);
     d=m/10;
     printNumber(d, 7);
     lcd.setCursor(14, 0);
     if(a){
       lcd.print("AM");
      }else{
         lcd.print("PM");
        }
        if(cnt==0){
           s++;
          lcd.setCursor(6, 0);
      lcd.print(" ");
       lcd.setCursor(6, 1);
      lcd.print(" ");
      delay(500);
    lcd.setCursor(6, 0);
      lcd.print(".");
       lcd.setCursor(6, 1);
      lcd.print(".");
      delay(500);
       }
      
   
   


}

moderator edit: code tags added

Hi @raiders9691. Are you using Arduino IDE, or are you using Arduino Cloud or Arduino Web Editor?

I ask because you have posted in the forum category used for discussion of subjects related to Arduino IDE 1.x, but reports of an "object object" error are usually made by Arduino Cloud users. If you are using Arduino Cloud then I will move your topic to the appropriate forum category where the people most knowledgeable on the subject will be more likely to see it.

Before asking questions:


If your sketch was generated with an AI like ChatGPT or by someone else tell us in your post.


  • Questioners know what their hardware and software looks like but the volunteers here do not; you need to fully explain what’s not working, and how it is supposed to work.
  • Please read all the posting guidelines before asking your questions; follow these guidelines in your post.

  • As always, show us a good schematic of your proposed circuit.
  • Show us good images of your ‘actual’ wiring.
  • Give WEB links to major components.

  • In the Arduino IDE, use Ctrl T or CMD T to format your code, then copy the complete sketch.
  • Use the < CODE / > icon from the ‘posting menu’ to attach your copied sketch.

When you follow the posting guidelines, volunteers can be more effective.

1 Like

I really don't know how to use the form but I believe it is IDE

Hello @raiders9691. Which version of Arduino IDE are you using (e.g., "2.0.1")? The version is shown on the window title bar and also in the Help > About dialog.

I ask for this information because I want to give you the appropriate instructions for the IDE version you are using.

I belive it is 2.1.0
And using web editor.
Thanks again

And in my editor it says cloud

Which operating system are you using (e.g., "Windows")?

I ask because I would like to give you the appropriate instructions for your operating system.

What does that mean?

2 Likes

I am using Web editor

also using windows on my laptop

I will do just that,
Thank you

Your code compiles correctly. Three buttons: up, down, start/stop.

Here is mine.
20230615_102746.jpg

Does this help

You have another, virtually equally incomprehensible (certainly equally badly posted) topic on this subject.

Please try again.

You said you would

  • In the Arduino IDE, use Ctrl T or CMD T to format your code, then copy the complete sketch.
  • Use the < CODE / > icon from the ‘posting menu’ to attach your copied sketch.

So your code

   /// ends up in a box looking like code

The <CODE/> button in the message composition window and

type or paste code here

TIA

a7

[ object Object ]

I'm out.

hard to see..
but looks like you index your custom chars wrong..
allowed 8 and they start at 0 end at 7..
try

lcd.createChar(0,bar1);
lcd.createChar(1,bar2);
lcd.createChar(2,bar3);
lcd.createChar(3,bar4);
lcd.createChar(4,bar5);
lcd.createChar(5,bar6);
lcd.createChar(6,bar7);
lcd.createChar(7,bar8);

and change indexes in rest of code, just subtract 1..

good luck.. ~q