Go Down

Topic: ERROR!!! (Read 944 times) previous topic - next topic

i_luv_arduino

Hello sorry I keep asking about errors but I am new.
I am making a ping pong game, an arduino with a proto-shield and an LCD.
I wrote a 700 line program, so no suprise there is an error.
There used to be three errors, now there is about 100.
Here is the 1/2 the code:
Code: [Select]
  ;lcd.print("Press go 2 play")
    ;val = digitalRead(inPin); 
  ;if (val == LOW)
  ;lcd.print("start in 3")
  ;delay(1000)
  ;lcd.clear()
  ;lcd.print("start in 2")
  ;delay(1000)
  ;lcd.clear()
  ;lcd.print("start in 1")
  ;delay(1000)
  ;lcd.clear()
  ;lcd.print("GO!")
  ;delay(1000)
  ;lcd.clear()
  ;lcd.write(2)
  ;lcd.print("      ")
  ;lcd.write(5)
  ;lcd.print("       ")
  ;lcd.write(2)
  ;lcd.setCursor(7, 0)
  ;lcd.write(3)
  ;delay(100)
   ;val = digitalRead(0); 
  ;if (val == LOW)
  x = x+1

    ;else
{
  break;
}


 
  //I WAS HERE
  ;lcd.setCursor(6, 0)
  ;lcd.write(3)
  ;delay(100) 
  ;if (pushButton == HIGH) {
  x = x+1
  }
   

  ;lcd.setCursor(5, 1)
  ;lcd.write(0)
  ;delay(100)
  ;if (pushButton == HIGH) {
  x = x+1
  }
   
  ;lcd.setCursor(4, 1)
  ;lcd.write(1)
  ;delay(100)
  ;if (pushButton == HIGH) {
  x = x+1
  }
 
  ;lcd.setCursor(3, 1)
  ;lcd.write(2)
  ;delay(100)
  ;if (pushButton == HIGH) {
  x = x+1
  }

  ;lcd.setCursor(2, 1)
  ;lcd.write(3)
  ;delay(100)
  ;if (x > 4)
{
  goto arduino; 
}
;else
{
goto gameover;
}
//after the first bounce, here is arduinos turn!!!

arduino;
;lcd.setCursor(3, 1)
;lcd.write(3)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
 
;lcd.setCursor(4, 1)
;lcd.write(2)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(5, 1)
;lcd.write(1)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(6, 1)
;lcd.write(0)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(7, 0)
;lcd.write(3)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }

;lcd.setCursor(8, 0)
;lcd.write(2)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }

;lcd.setCursor(9, 0)
;lcd.write(1)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }

;lcd.setCursor(10, 0)
;lcd.write(0)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }

;lcd.setCursor(11, 0)
;lcd.write(1)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(12, 0)
;lcd.write(2)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(13, 0)
;lcd.write(3)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(14, 1)
;lcd.write(0)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(15, 1)
;lcd.write(1)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(16, 1)
;lcd.write(2)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
//arduino just got hit by the ball
;lcd.setCursor(15, 1)
;lcd.write(2)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(14, 1)
;lcd.write(1)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
 
;lcd.setCursor(13, 1)
;lcd.write(1)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }
;lcd.setCursor(13, 1)
;lcd.write(1)
;delay(100)
;if (pushButton == HIGH) {
  x = x+1
  }




 
        ;}
       
       
gameover;
lcd.print("   GAME OVER!   ")
delay(10000)


That is the end of it...

i_luv_arduino

Here is the rest, the begining:
Code: [Select]
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


byte paddleup[8] = {
  0b10000,
  0b10000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

byte paddletwo[8] = {
  0b00000,
  0b00000,
  0b10000,
  0b10000,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

byte paddleone[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b10000,
  0b10000,
  0b00000,
  0b00000
};

byte paddledown[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b10000,
  0b10000

};
byte ballone[8] = {
  0b00000,
  0b00100,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

byte balltwo[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00100,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

byte ballthree[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00100,
  0b00000,
  0b00000
};
byte ballfour[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00100
};
byte win[8] = {
  0b10101,
  0b01010,
  0b10101,
  0b01010,
  0b10101,
  0b01010,
  0b10101,
  0b01010
};







void setup() {
  // set up the LCD's number of columns and rows:
  lcd.createChar(0, ballone);
  // create a new character
  lcd.createChar(1, balltwo);
  // create a new character
  lcd.createChar(2, ballthree);
  // create a new character
  lcd.createChar(3, ballfour); 
  // create a new character
  lcd.createChar(4, paddleup);
  // create a new character
  lcd.createChar(5, paddletwo);
  // create a new character
  lcd.createChar(6, paddleone);
  // create a new character
  lcd.createChar(7, paddledown); 
  // create a new character
  lcd.createChar(8, win);
 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("arduino pingpong");
}

x = 0

pushButton = 0;

void loop() {;

i_luv_arduino

I skiped most of the code because it was a ~500 line GIF

i_luv_arduino

PS. I skiped half the ERRORs by putting semi colons before most statements.

Delta_G


PS. I skiped half the ERRORs by putting semi colons before most statements.


Semicolons go at the end of statements.  If it says expected ; before ...  that means you left one out on the line above.  No line should EVER start with a semicolon.

KeithRB

Everything after a semicolon is not a comment, it is another statement. Use // to comment out lines, or /* ...*/ pairs if you are a picky C programmer. 8^)

Arrch

I'm fairly certain this guy is a troll, because in numerous threads, he's been told about his semicolon issue and he completely ignores us.

i_luv_arduino

Sorry about that, I am not a troll, lol.
But the others who tried to explain it didn't really make it clear.
I fixed that problem but is there anything to debug, particularley variables, most of the errors are about variables?
Sorry about not listening to the semi colon thing you guys are the only help I have understood.

PeterH


Sorry about that, I am not a troll, lol.
But the others who tried to explain it didn't really make it clear.
I fixed that problem but is there anything to debug, particularley variables, most of the errors are about variables?
Sorry about not listening to the semi colon thing you guys are the only help I have understood.


You simply need to read and understand the error message, and look at the piece of code it relates to. If you can't make sense of it post your code (the whole file that causes the error) and the error messages that you get when you try to compile it, and usually somebody will explain what the message means.
I only provide help via the forum - please do not contact me for private consultancy.

wildbill

As I just said in another thread, look at the first error, fix it and recompile. Rinse and repeat. Your first few errors appear to be that you haven't declared variables. This:

Code: [Select]

x = 0

pushButton = 0;


Should likely be this:
Code: [Select]

int x = 0;
int pushButton = 0;


Similarly, the next couple of issues are items not declared in loop. But please, for the love of the FSM, sort those semi-colons out.

i_luv_arduino

Thank you very much wildbill, you have been most helpful. But back to the point, I debugged a few errors but I got stumped at this error:
call of overloaded 'write(int)' is ambiguous
here is the code it is in
Code: [Select]
;lcd.write(0)

i_luv_arduino

sorry about the semi colon there I copied it before I changed it! :smiley-roll-blue: :smiley-roll-blue: :smiley-roll-blue:

GoForSmoke

You should probably go through a few of the example projects just to see what code should look like.

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

i_luv_arduino

ya thanks, but I actaully copied and pasted, from example code and I have looked at almost all of them.

PeterH


sorry about the semi colon there I copied it before I changed it! :smiley-roll-blue: :smiley-roll-blue: :smiley-roll-blue:


Now I'm certain you're trolling. Nobody could genuinely be that obtuse.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up