How do I get rid of the adafruit logo?

Hi!

I'm following a tutorial on how to make a pong game as a project, everything was going fine until I ran the code provided. The display just shows the Adafruit logo when it is supposed to display the actual pong game. I don't know much about coding so I'm not sure what went wrong. If anyone can let me know what might be wrong or what I can do to fix it, that would be a great help!

Here's the code:

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 display(4);

int resolution[2] = {128, 64}, ball[2] = {20, (resolution[1] / 2)};
const int PIXEL_SIZE = 8, WALL_WIDTH = 4, PADDLE_WIDTH = 4, BALL_SIZE = 4, SPEED = 3;
int playerScore = 0, aiScore = 0, playerPos = 0, aiPos = 0;
char ballDirectionHori = 'R', ballDirectionVerti = 'S';
boolean inProgress = true;

void setup()   {
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.display();
}

void loop() {
  if (aiScore > 9 || playerScore > 9) {
    // check game state
    inProgress = false;
  }

  if (inProgress) {
    eraseScore();
    eraseBall(ball[0], ball[1]);

    if (ballDirectionVerti == 'U') {
      // move ball up diagonally
      ball[1] = ball[1] - SPEED;
    }

    if (ballDirectionVerti == 'D') {
      // move ball down diagonally
      ball[1] = ball[1] + SPEED;
    }

    if (ball[1] <= 0) { // bounce the ball off the top ballDirectionVerti = 'D'; } if (ball[1] >= resolution[1]) {
      // bounce the ball off the bottom
      ballDirectionVerti = 'U';
    }

    if (ballDirectionHori == 'R') {
      ball[0] = ball[0] + SPEED; // move ball
      if (ball[0] >= (resolution[0] - 6)) {
        // ball is at the AI edge of the screen
        if ((aiPos + 12) >= ball[1] && (aiPos - 12) <= ball[1]) { // ball hits AI paddle if (ball[1] > (aiPos + 4)) {
            // deflect ball down
            ballDirectionVerti = 'D';
          }
          else if (ball[1] < (aiPos - 4)) {
            // deflect ball up
            ballDirectionVerti = 'U';
          }
          else {
            // deflect ball straight
            ballDirectionVerti = 'S';
          }
          // change ball direction
          ballDirectionHori = 'L';
        }
        else {
          // GOAL!
          ball[0] = 6; // move ball to other side of screen
          ballDirectionVerti = 'S'; // reset ball to straight travel
          ball[1] = resolution[1] / 2; // move ball to middle of screen
          ++playerScore; // increase player score
        }
      }
    }

    if (ballDirectionHori == 'L') {
      ball[0] = ball[0] - SPEED; // move ball
      if (ball[0] <= 6) { // ball is at the player edge of the screen if ((playerPos + 12) >= ball[1] && (playerPos - 12) <= ball[1]) { // ball hits player paddle if (ball[1] > (playerPos + 4)) {
            // deflect ball down
            ballDirectionVerti = 'D';
          }
          else if (ball[1] < (playerPos - 4)) { // deflect ball up ballDirectionVerti = 'U'; } else { // deflect ball straight ballDirectionVerti = 'S'; } // change ball direction ballDirectionHori = 'R'; } else { ball[0] = resolution[0] - 6; // move ball to other side of screen ballDirectionVerti = 'S'; // reset ball to straight travel ball[1] = resolution[1] / 2; // move ball to middle of screen ++aiScore; // increase AI score } } } drawBall(ball[0], ball[1]); erasePlayerPaddle(playerPos); playerPos = analogRead(A2); // read player potentiometer playerPos = map(playerPos, 0, 1023, 8, 54); // convert value from 0 - 1023 to 8 - 54 drawPlayerPaddle(playerPos); moveAi(); drawNet(); drawScore(); } else { // somebody has won display.clearDisplay(); display.setTextSize(4); display.setTextColor(WHITE); display.setCursor(0, 0); // figure out who if (aiScore > playerScore) {
      display.println("YOU  LOSE!");
    }
    else if (playerScore > aiScore) {
      display.println("YOU  WIN!");
    }
  }

  display.display();
}

void moveAi() {
  // move the AI paddle
  eraseAiPaddle(aiPos);
  if (ball[1] > aiPos) {
    ++aiPos;
  }
  else if (ball[1] < aiPos) {
    --aiPos;
  }
  drawAiPaddle(aiPos);
}

void drawScore() {
  // draw AI and player scores
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(45, 0);
  display.println(playerScore);

  display.setCursor(75, 0);
  display.println(aiScore);
}

void eraseScore() {
  // erase AI and player scores
  display.setTextSize(2);
  display.setTextColor(BLACK);
  display.setCursor(45, 0);
  display.println(playerScore);

  display.setCursor(75, 0);
  display.println(aiScore);
}

void drawNet() {
  for (int i = 0; i < (resolution[1] / WALL_WIDTH); ++i) {
    drawPixel(((resolution[0] / 2) - 1), i * (WALL_WIDTH) + (WALL_WIDTH * i), WALL_WIDTH);
  }
}

void drawPixel(int posX, int posY, int dimensions) {
  // draw group of pixels
  for (int x = 0; x < dimensions; ++x) {
    for (int y = 0; y < dimensions; ++y) {
      display.drawPixel((posX + x), (posY + y), WHITE);
    }
  }
}

void erasePixel(int posX, int posY, int dimensions) {
  // erase group of pixels
  for (int x = 0; x < dimensions; ++x) {
    for (int y = 0; y < dimensions; ++y) {
      display.drawPixel((posX + x), (posY + y), BLACK);
    }
  }
}

void erasePlayerPaddle(int row) {
  erasePixel(0, row - (PADDLE_WIDTH * 2), PADDLE_WIDTH);
  erasePixel(0, row - PADDLE_WIDTH, PADDLE_WIDTH);
  erasePixel(0, row, PADDLE_WIDTH);
  erasePixel(0, row + PADDLE_WIDTH, PADDLE_WIDTH);
  erasePixel(0, row + (PADDLE_WIDTH + 2), PADDLE_WIDTH);
}

void drawPlayerPaddle(int row) {
  drawPixel(0, row - (PADDLE_WIDTH * 2), PADDLE_WIDTH);
  drawPixel(0, row - PADDLE_WIDTH, PADDLE_WIDTH);
  drawPixel(0, row, PADDLE_WIDTH);
  drawPixel(0, row + PADDLE_WIDTH, PADDLE_WIDTH);
  drawPixel(0, row + (PADDLE_WIDTH + 2), PADDLE_WIDTH);
}

void drawAiPaddle(int row) {
  int column = resolution[0] - PADDLE_WIDTH;
  drawPixel(column, row - (PADDLE_WIDTH * 2), PADDLE_WIDTH);
  drawPixel(column, row - PADDLE_WIDTH, PADDLE_WIDTH);
  drawPixel(column, row, PADDLE_WIDTH);
  drawPixel(column, row + PADDLE_WIDTH, PADDLE_WIDTH);
  drawPixel(column, row + (PADDLE_WIDTH * 2), PADDLE_WIDTH);
}

void eraseAiPaddle(int row) {
  int column = resolution[0] - PADDLE_WIDTH;
  erasePixel(column, row - (PADDLE_WIDTH * 2), PADDLE_WIDTH);
  erasePixel(column, row - PADDLE_WIDTH, PADDLE_WIDTH);
  erasePixel(column, row, PADDLE_WIDTH);
  erasePixel(column, row + PADDLE_WIDTH, PADDLE_WIDTH);
  erasePixel(column, row + (PADDLE_WIDTH * 2), PADDLE_WIDTH);
}

void drawBall(int x, int y) {
  display.drawCircle(x, y, BALL_SIZE, WHITE);
}

void eraseBall(int x, int y) {
  display.drawCircle(x, y, BALL_SIZE, BLACK);
}

What do your Serial.print() statements tell you is happening?

Why not?

Did you upload any other sketch on your arduino, as for example a sketch displaying the logo, before trying to upload the pong sketch?

If yes, then this means that the pong game is not uploaded, for any reason (have a look at the compiler comments at the lower part of the IDE), maybe a compilation error prevented the code from being uploaded. The arduino only runs the code it has in memory, in your case the code displaying the logo...

In any case, paste the compiler's comments in your answer to this thread, please.

The compiler comments just say

"Sketch uses 13802 bytes (42%) of program storage space. Maximum is 32256 bytes.
Global variables use 374 bytes (18%) of dynamic memory, leaving 1674 bytes for local variables. Maximum is 2048 bytes."

Also, the logo automatically popped up once I uploaded the code!

Also, the logo automatically popped up once I uploaded the code!

Yes, it is intended that that happen. As soon as you draw something else, the logo will be overwritten.

So, draw a blank screen.

You still don't seem to have added any Serial.begin() and/or Serial.print() statements, to prove that setup() ended, and loop() began.

  display.display();

Comment out this line in setup()