Pages: [1] 2   Go Down
Author Topic: ERROR!!!  (Read 628 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
  ;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...
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the rest, the begining:
Code:
#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() {;
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
God Member
*****
Karma: 10
Posts: 646
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Edison Member
*
Karma: 18
Posts: 1170
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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^)
Logged

California
Offline Offline
Faraday Member
**
Karma: 82
Posts: 3123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 183
Posts: 11142
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

New Jersey
Online Online
Faraday Member
**
Karma: 48
Posts: 3395
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
x = 0

pushButton = 0;

Should likely be this:
Code:
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.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
;lcd.write(0)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 58
Posts: 3994
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

 
Logged

Examples can be found in your IDE.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Shannon Member
****
Karma: 183
Posts: 11142
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1] 2   Go Up
Jump to: