Problem with oled screen 0.9

I tell you, I adapted an old code for a work of the university an oled screen, copy the example code to make the screen work, and it works but the adafruit logo appears, but I don't see it anywhere, any idea?

#define rfReceivePin A0     //RF Receiver data pin = Analog pin 1
#define rfTransmitPin 2  //RF Transmitter pin = digital pin 1
#define button 4           //The button attached to digital pin 3
#define ledPin 13        //Onboard LED = digital pin 4
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

const int dataSize = 500;  //Arduino memory is limited (max=1700)
byte storedData[dataSize];  //Create an array to store the data
const unsigned int threshold = 100;  //signal threshold value
int maxSignalLength = 255;   //Set the maximum length of the signal
int dataCounter = 0;    //Variable to measure the length of the signal
int buttonState = 1;    //Variable to control the flow of code using button presses
int buttonVal = 0;      //Variable to hold the state of the button
int timeDelay = 105;    //Used to slow down the signal transmission (can be from 75 - 135)

void setup() {
  Serial.begin(9600);

  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
  }
    display.display();
  delay(2000); // Pause for 2 seconds

  pinMode(rfTransmitPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(button, INPUT);
}

void loop() {
  digitalWrite(button, HIGH);
  buttonVal = digitalRead(button);

  if (buttonState > 0 && buttonVal == LOW) {
    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    display.println("Capturando señal...");
    display.display();
    initVariables();
    listenForSignal();

  }else{
            display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    display.println("esperando boton...");
    display.display();
  }
  digitalWrite(button, HIGH);
  buttonVal = digitalRead(button);

  if (buttonState < 1 && buttonVal == LOW) {
    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    display.println("Señal enviada!");
    display.display();
    sendSignal();
  }else{
        display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    display.println("esperando boton...");
    display.display();
  }

  delay(20);
}



void initVariables() {
  for (int i = 0; i < dataSize; i++) {
    storedData[i] = 0;
  }
  buttonState = 0;
}



void listenForSignal() {
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  while (analogRead(rfReceivePin) < threshold) {
    //Wait here until an RF signal is received
  }
  digitalWrite(ledPin, HIGH);

  //Read and store the rest of the signal into the storedData array
  for (int i = 0; i < dataSize; i = i + 2) {

    //Identify the length of the HIGH signal---------------HIGH
    dataCounter = 0; //reset the counter
    while (analogRead(rfReceivePin) > threshold && dataCounter < maxSignalLength) {
      dataCounter++;
    }
    storedData[i] = dataCounter;  //Store the length of the HIGH signal


    //Identify the length of the LOW signal---------------LOW
    dataCounter = 0; //reset the counter
    while (analogRead(rfReceivePin) < threshold && dataCounter < maxSignalLength) {
      dataCounter++;
    }
    storedData[i + 1] = dataCounter; //Store the length of the LOW signal
  }

  storedData[0]++;  //Account for the first AnalogRead>threshold = lost while listening for signal
  digitalWrite(ledPin, LOW);
}


void sendSignal() {
  digitalWrite(ledPin, HIGH);
  for (int i = 0; i < dataSize; i = i + 2) {
    //Send HIGH signal
    digitalWrite(rfTransmitPin, HIGH);
    delayMicroseconds(storedData[i]*timeDelay);
    //Send LOW signal
    digitalWrite(rfTransmitPin, LOW);
    delayMicroseconds(storedData[i + 1]*timeDelay);
  }
  digitalWrite(ledPin, LOW);
  delay(1000);

}

the logo appears as if it were that, a startup logo, like when you turn on your cell phone the logo appears, but I don't want it to appear, I want to place one of my own

I’d be putting

display.clearDisplay();
  • straight after initialising the display driver.

the logo also appears, it's quite rare

The logo is defined in the SSD1036 library, in "splash.h".

You can replace the data statements, or disable it.

great thanks, I'm going to try it, I still found a temporary solution, removing this delay

void setup() {
  Serial.begin(9600);

  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
  }
    display.display();
  delay(2000); // Pause for 2 seconds 

removing this 2 second delay, only a weird image comes out for less than 1 second

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