Initializer fails to determine size of '__pstr__' ERROR

Hi,
I am using a SSD1306 Display with a Nodemcu, text displays fine when I code it directly but if I try to display text inside a variable i get the error:

initializer fails to determine size of 'pstr'

Anyone know what I am doing wrong?

#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 64 // 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);

#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16





int ace = 5;
String bob = "test";



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

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

 
 
}

void loop() {

  test();
  
}



void test() {
  
  display.clearDisplay();
  display.setTextSize(2);             // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
  display.print(F(bob)); 
  
  Serial.print("bob = ");
  Serial.println,(bob);
  display.display();
  delay(2000);
}

The F macro expects a string literal, not a variable.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with your project.

OK, thank you.
Could you give me some guidance at to what that is?
How do I declare that?

Hello Fred, Good day.

Please try to use some code examples from github fitting to you SSD1306 Display. You can find them here:

Best regards Markus

Thank you but I have been through each of those already...

A text literal is just quoted text. The F() macro would be used like this:

display.print(F("test"));

It is also possible to use text stored in a char array, but the char array has to be declared const, and you have to explicitly tell the compiler to store the array in program memory by using the keyword PROGMEM. When printing, the char array has to be cast to __FlashStringHelper* so that the correct print function will be used. Note that you cannot use String for this.

const char bob[] PROGMEM = "test";

display.print((__FlashStringHelper*)bob);
1) display.print(bob); //take the F option out
2) Serial.println(bob); //take the comma out not needed

This works.
Thank you very much

Thank you, this also works.

Next issue is I have is I need to be able to dynamically assign bob but this keeps throwing up errors, see code below.
Im not sure how to declare this correctly...

incompatible types in assignment of 'const char [6]' to 'char [1]'

#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 64 // 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);

#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16





int ace = 5;
char bob[] PROGMEM = "";



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

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

 
 
}

void loop() {

  bob = "test1";
  test();
  
}



void test() {
  
  display.clearDisplay();
  display.setTextSize(2);             // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
  //display.print((bob)); 
  display.print((__FlashStringHelper*)bob);
  
  Serial.print("bob = ");
  Serial.println(bob);
  display.display();
  delay(2000);
}

You can't. If you want to use 'F()', PROGMEM, etc then the value is set at compile-time. That's it.

OK.
So how do I approach this?
All I want to do is display the contents of a dynamic variable (bob) on the display?

Then don't use 'F()', PROGMEM, etc. Just use a regular array of char. Use C-string Functions such as strcpy() to change its contents.

OK, I was just doing what people had recommended so far.
Doing it as you suggested gets me closer, I can print the variable bob if i define it on the fly but once i apply this technique to my actual code i get the below error
cannot convert 'String' to 'char' in initialization

In my actual application the variable is getting data from an api lookup.

char temp[6] = {(payload.substring(x-1, x+4))};
strncpy(Atlas_temp, temp, sizeof Atlas_temp);

If I just code char temp[6] = "0.020" which is exactly what is returned, it works.
Sorry, i am still earning, just not sure where to go from here, I keep going in circles.

Don't confuse the String class with C-strings [arrays of char]. It looks like your payload variable is of type String. It is best to avoid the String class on microcontrollers will very limited memory and just use regular char arrays instead.

There is also a function .c_str() which returns a pointer to the underlying array.

char *ptr = payload.c_str();
ptr = ptr + x - 1;
strncpy(temp, ptr, 5);
...

Thank you, trying that code i get an error...

invalid conversion from 'const char*' to 'char' [-fpermissive]

C++ is very insistent that you use the correct data type. 'c_str()' returns a 'const char *'. See Wstring.h:

const char* c_str() const { return buffer; }

So:

const char *ptr = payload.c_str();

Thanks but that then gives error:

non-member function 'const char* c_str()' cannot have cv-qualifier

Post your complete code every time you make even the smallest change. Don't make it difficult for people that are willing to help.

OK, here is the full code, its just getting large and thought it would be more confusing to include it all. But thanks, I do appreciate your help.

Makes connection with wifi manager
API looks up multiple currencies & displays it. Works.
Have to reduce frequency of api polls so wanted to copy payload to a variable and just cycle through displaying those in between api polls, this is where I am stuck.


#include <Arduino.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h>

#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>         // https://github.com/tzapu/WiFiManager
#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 64 // 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);

ESP8266WiFiMulti WiFiMulti;
  
// Set web server port number to 80
WiFiServer server(80);

// Variable to store the HTTP request
String header;

// Auxiliar variables to store the current output state
String output5State = "off";
String output4State = "off";
char Atlas_temp[5] = "---";
char Polis_temp[5] = "---";
char temp1[5] = "";

const char* c_str() const { return buffer; }



// Assign output variables to GPIO pins
const int output5 = 5;
const int output4 = 4;

int Not_First_Pass = 0;
int Cycle=0;
int Poll=0;


void setup() {
  Serial.begin(115200);
  
  // Initialize the output variables as outputs
  pinMode(output5, OUTPUT);
  pinMode(output4, OUTPUT);
  // Set outputs to LOW
  digitalWrite(output5, LOW);
  digitalWrite(output4, LOW);

  // WiFiManager
  // Local intialization. Once its business is done, there is no need to keep it around
  WiFiManager wifiManager;
  
  // Uncomment and run it once, if you want to erase all the stored information
  //wifiManager.resetSettings();
  
  // set custom ip for portal
  //wifiManager.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));

  // fetches ssid and pass from eeprom and tries to connect
  // if it does not connect it starts an access point with the specified name
  // here  "AutoConnectAP"
  // and goes into a blocking loop awaiting configuration

 //
 //

 
  
  wifiManager.autoConnect("Crypto Buddi");

  
  // wifiManager.autoConnect("AutoConnectAP");
  // or use this for auto generated name ESP + ChipID
  //wifiManager.autoConnect();
  
  // if you get here you have connected to the WiFi
  //Serial.println("Connected.");

  server.begin();
}

void loop(){



           

  
  WiFiClient client = server.available();   // Listen for incoming clients

  if (client) {                            // If a new client connects,
    Serial.println("New Client.");          // print a message out in the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        header += c;
        if (c == '\n') {                    // if the byte is a newline character
          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println("Connection: close");
            client.println();
            
            // turns the GPIOs on and off
            if (header.indexOf("GET /5/on") >= 0) {
              Serial.println("GPIO 5 on");
              output5State = "on";
              digitalWrite(output5, HIGH);
            } else if (header.indexOf("GET /5/off") >= 0) {
              Serial.println("GPIO 5 off");
              output5State = "off";
              digitalWrite(output5, LOW);
            } else if (header.indexOf("GET /4/on") >= 0) {
              Serial.println("GPIO 4 on");
              output4State = "on";
              digitalWrite(output4, HIGH);
            } else if (header.indexOf("GET /4/off") >= 0) {
              Serial.println("GPIO 4 off");
              output4State = "off";
              digitalWrite(output4, LOW);
            }
            
            // Display the HTML web page
            client.println("<!DOCTYPE html><html>");
            client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
            client.println("<link rel=\"icon\" href=\"data:,\">");
            // CSS to style the on/off buttons 
            // Feel free to change the background-color and font-size attributes to fit your preferences
            client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
            client.println(".button { background-color: #195B6A; border: none; color: white; padding: 16px 40px;");
            client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
            client.println(".button2 {background-color: #77878A;}</style></head>");
            
            // Web Page Heading
            client.println("<body><h1>CRYPTO BUDDI</h1>");
            
            // Display current state, and ON/OFF buttons for GPIO 5  
            client.println("<p>GPIO 5 - State " + output5State + "</p>");
            // If the output5State is off, it displays the ON button       
            if (output5State=="off") {
              client.println("<p><a href=\"/5/on\"><button class=\"button\">ON</button></a></p>");
            } else {
              client.println("<p><a href=\"/5/off\"><button class=\"button button2\">OFF</button></a></p>");
            } 
               
            // Display current state, and ON/OFF buttons for GPIO 4  
            client.println("<p>GPIO 4 - State " + output4State + "</p>");
            // If the output4State is off, it displays the ON button       
            if (output4State=="off") {
              client.println("<p><a href=\"/4/on\"><button class=\"button\">ON</button></a></p>");
            } else {
              client.println("<p><a href=\"/4/off\"><button class=\"button button2\">OFF</button></a></p>");
            }
            client.println("</body></html>");
            
            // The HTTP response ends with another blank line
            client.println();
            // Break out of the while loop
            break;
          } else { // if you got a newline, then clear currentLine
            currentLine = "";
          }
        } else if (c != '\r') {  // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }
      }
    }
    // Clear the header variable
    header = "";
    // Close the connection
    client.stop();
    Serial.println("Client disconnected.");
    Serial.println("");
  }


 Draw_Icon();

  //
  // Display Initializing msg on lcd
  //
            Cycle = Cycle + 1;
            Serial.print("Cycle = ");
            Serial.println(Cycle);
            Serial.print("Poll = ");
            Serial.println(Poll);
            
            if ((Cycle == 1) or (Cycle > 60)) {
                
                Serial.println("");
                Serial.println("POLL");
                Serial.println("");
                
                Lookup_Star_Atlas();
                Lookup_Polis();
                Poll = Poll + 1;
                Cycle = 2;
                }
              else{

                Serial.println("");
                Serial.println("DONT POLL");
                Serial.println("");
                
                Display_Star_Atlas();
                
                }

            
  
}






void clear_display(void) {
  
  //
  // Clears Display
  //
  
  display.clearDisplay();
  display.setTextSize(1);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(30,2);             // Start at top-left corner
  Serial.println("Clearing Display");
  display.display();
}


void updating_msg(void) {
  
  //
  // ...
  //
  
  display.clearDisplay();
  display.setTextSize(1);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(30,2);             // Start at top-left corner
  display.println(F("UPDATING"));
  Serial.println("Updating");
  display.display();
}



void graphic(void) {
  
  //
  // ...
  //
  

  Serial.println("Graphic");
  display.display();
  display.clearDisplay();
  display.drawPixel(10, 10, SSD1306_WHITE);
  display.drawPixel(10, 11, SSD1306_WHITE);
  display.drawPixel(10, 12, SSD1306_WHITE);
  display.display();
}





void Lookup_Star_Atlas() {
  // wait for WiFi connection
  if ((WiFiMulti.run() == WL_CONNECTED)) {

    std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);

    client->setInsecure();

    HTTPClient https;

    Serial.print("[HTTPS] begin...\n");

      //
      //  If just turned ON Display msg on lcd
      //
      Serial.print("Not_First_Pass = ");
      Serial.println(Not_First_Pass);
      if (Not_First_Pass == 0) {
        display.setTextSize(1);             // Normal 1:1 pixel scale
        display.setTextColor(SSD1306_WHITE);        // Draw white text
        display.setCursor(20,2);             // Start at top-left corner
        display.println(F("WiFi CONNECTED"));
        display.setCursor(25,20);             // Start at top-left corner
        display.println(F("Getting Data"));
        display.display();
        } 

        delay(3000);
    
    if (https.begin(*client, "https://api.coingecko.com/api/v3/simple/price?ids=star-atlas&vs_currencies=usd")) {  // HTTPS

      Serial.print("[HTTPS] GET...\n");
      // start connection and send HTTP header
      int httpCode = https.GET();

      // httpCode will be negative on error
      if (httpCode > 0) {
        // HTTP header has been send and Server response header has been handled
        Serial.printf("[HTTPS] GET... code: %d\n", httpCode);

        // file found at server
        if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
          String payload = https.getString();
          Serial.println(payload);
          Not_First_Pass = 1;

            //
            // Display Title
            //
            display.clearDisplay();
            Draw_Icon();
            display.setTextSize(1);             // Normal 1:1 pixel scale
            display.setTextColor(SSD1306_WHITE);        // Draw white text
            display.setCursor(33,2);             // Start at top-left corner
            display.println(F("STAR ATLAS"));


            //
            // Display Price Size 3
            //
            display.setTextSize(3);             // Normal 1:1 pixel scale
            display.setTextColor(SSD1306_WHITE);        // Draw white text
            display.setCursor(20,25);             // Start at top-left corner
            
            
            int x=1;
a:          if (payload.substring(x, x+1) == ".") 
     
              {
                Serial.println(x);
                Serial.println(payload.substring(x-1, x+2));
                display.println(payload.substring(x-1, x+4));
                
                
                //char temp[6] = {(payload.substring(x-1, x+4))};
                //char *ptr = payload.substring(x-1, x+4)).c_str();
                //char ptr = payload.c_str();

                const char *ptr = payload.c_str();
                
                ptr = ptr + x - 1;
                strncpy(temp, ptr, 5);
                
                Serial.print("t=");
                Serial.println(temp);
                
                strncpy(Atlas_temp, temp, sizeof Atlas_temp);
                Serial.print("at=");
                Serial.println(Atlas_temp);
                delay(10000);
              }
  
            else
  
              {
                x=x+1;
                goto a;  
              }

            //
            //
            //
            
            
            
            display.display();


          
        }
      } else {
        Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());

            //
            // Display Failed msg on lcd
            //
            //display.clearDisplay();
            display.setTextSize(1);             // Normal 1:1 pixel scale
            display.setTextColor(SSD1306_WHITE);        // Draw white text
            display.setCursor(20,30);             // Start at top-left corner
            display.println(F("Download Failed"));
            display.display();
      
      }

      https.end();
    } else {
      Serial.printf("[HTTPS] Unable to connect\n");
    }
  }

  Serial.println("Wait before next update...");
  delay(5000);
  display.clearDisplay();
  Draw_Icon();
}





void Display_Star_Atlas() {
            
            //
            // Display Title
            //
            display.clearDisplay();
            Draw_Icon();
            display.setTextSize(1);             // Normal 1:1 pixel scale
            display.setTextColor(SSD1306_WHITE);        // Draw white text
            display.setCursor(33,2);             // Start at top-left corner
            display.println(F("STAR ATLAS"));
            display.display();


            //
            // Display Price Size 3
            //
            display.setTextSize(3);             // Normal 1:1 pixel scale
            display.setTextColor(SSD1306_WHITE);        // Draw white text
            display.setCursor(20,25);             // Start at top-left corner
            Serial.println(Atlas_temp);
            //display.println(F(Atlas_temp));
            //display.print((__FlashStringHelper*)Atlas_temp);
            display.print((Atlas_temp));
            display.display();

            
            Serial.println("Wait before next dummy update...");
            delay(5000);
            display.clearDisplay();
            Draw_Icon();



}






void Lookup_Polis() {
  // wait for WiFi connection
  if ((WiFiMulti.run() == WL_CONNECTED)) {

    std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);

    client->setInsecure();

    HTTPClient https;

    Serial.print("[HTTPS] begin...\n");

      //
      //  If just turned ON Display msg on lcd
      //
      
      if (Not_First_Pass == 0) {
        display.setTextSize(1);             // Normal 1:1 pixel scale
        display.setTextColor(SSD1306_WHITE);        // Draw white text
        display.setCursor(20,2);             // Start at top-left corner
        display.println(F("WiFi CONNECTED"));
        display.setCursor(25,20);             // Start at top-left corner
        display.println(F("Getting Data"));
        display.display();
        } 


      if (https.begin(*client, "https://api.coingecko.com/api/v3/simple/price?ids=star-atlas-dao&vs_currencies=usd")) {  // HTTPS

        Serial.print("[HTTPS] GET...\n");
        // start connection and send HTTP header
        int httpCode = https.GET();

        // httpCode will be negative on error
        if (httpCode > 0) {
          // HTTP header has been send and Server response header has been handled
          Serial.printf("[HTTPS] GET... code: %d\n", httpCode);

          // file found at server
          if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
            String payload = https.getString();
            Serial.println(payload);
            Not_First_Pass = 1;

            //
            // Display Title
            //
            
            display.setTextSize(1);             // Normal 1:1 pixel scale
            display.setTextColor(SSD1306_WHITE);        // Draw white text
            display.setCursor(44,2);             // Start at top-left corner
            display.println(F("POLIS"));


            //
            // Display Price Size 3
            //
            display.setTextSize(3);             // Normal 1:1 pixel scale
            display.setTextColor(SSD1306_WHITE);        // Draw white text
            display.setCursor(20,25);             // Start at top-left corner       
            
            //
            //  Extract 1 char to left of decimal point to 2 to the right of decimal point
            //

            int x=1;
a:          if (payload.substring(x, x+1) == ".") 
              {

                //
                // Check if result is 1.8} format, if so trim tailing } char
                //
                Serial.println("x substring = ");
                Serial.print(payload.substring(x+3, x+2));
                if (payload.substring(x+3, x+2) == "}") 
                  {
                  Serial.println("Trimming }");
                  Serial.println(x);
                  Serial.println(payload.substring(x-1, x+2));
                  display.println(payload.substring(x-1, x+2));
                  }
                  else
                  {
                  Serial.println(x);
                  Serial.println(payload.substring(x-1, x+3));
                  display.println(payload.substring(x-1, x+3));
                  
                  }
              }
            else
  
              {
                x=x+1;
                goto a;  
              }
            

            //
            //
            //
            
            
            
            display.display();


          
        }
      } else {
        Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());

            //
            // Display Failed msg on lcd
            //
            //display.clearDisplay();
            display.setTextSize(1);             // Normal 1:1 pixel scale
            display.setTextColor(SSD1306_WHITE);        // Draw white text
            display.setCursor(20,30);             // Start at top-left corner
            display.println(F("Download Failed"));

            //display.setTextSize(2);             // Normal 1:1 pixel scale
            //display.setTextColor(SSD1306_WHITE);        // Draw white text
            //display.setCursor(20,30);             // Start at top-left corner
            //display.println(payload);
            display.display();
      
      }

      https.end();
    } else {
      Serial.printf("[HTTPS] Unable to connect\n");
    }
  }



  Serial.println("Wait before next update...");
  delay(5000);
  display.clearDisplay();
  Draw_Icon();
}




void Draw_Icon(){

   //
   // Draw WIFI Icon
   //
   
   if ((WiFiMulti.run() == WL_CONNECTED)) {
   Serial.println("Connected."); 
   
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
    }
    display.clearDisplay();
    display.drawPixel(117, 1, SSD1306_WHITE);
    display.drawPixel(118, 1, SSD1306_WHITE);
    display.drawPixel(119, 1, SSD1306_WHITE);
    display.drawPixel(120, 1, SSD1306_WHITE);
    display.drawPixel(121, 1, SSD1306_WHITE);
    display.drawPixel(122, 1, SSD1306_WHITE);
    display.drawPixel(123, 1, SSD1306_WHITE);
    
    display.drawPixel(116, 2, SSD1306_WHITE);
    display.drawPixel(124, 2, SSD1306_WHITE);
    
    display.drawPixel(115, 3, SSD1306_WHITE);
    display.drawPixel(125, 3, SSD1306_WHITE);

    display.drawPixel(118, 4, SSD1306_WHITE);
    display.drawPixel(119, 4, SSD1306_WHITE);
    display.drawPixel(120, 4, SSD1306_WHITE);
    display.drawPixel(121, 4, SSD1306_WHITE);
    display.drawPixel(122, 4, SSD1306_WHITE);

    display.drawPixel(117, 5, SSD1306_WHITE);
    display.drawPixel(123, 5, SSD1306_WHITE);

    display.drawPixel(116, 6, SSD1306_WHITE);
    display.drawPixel(124, 6, SSD1306_WHITE);

    display.drawPixel(119, 7, SSD1306_WHITE);
    display.drawPixel(120, 7, SSD1306_WHITE);
    display.drawPixel(121, 7, SSD1306_WHITE);

    display.drawPixel(118, 8, SSD1306_WHITE);
    display.drawPixel(122, 8, SSD1306_WHITE);

    display.drawPixel(120, 9, SSD1306_WHITE);

    display.drawPixel(119, 10, SSD1306_WHITE);
    display.drawPixel(120, 10, SSD1306_WHITE);
    display.drawPixel(121, 10, SSD1306_WHITE);

    display.drawPixel(120, 11, SSD1306_WHITE);
    
    
    display.display();
    }
  else{
    Serial.println("Not Connected.");
      if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
          Serial.println(F("SSD1306 allocation failed"));
          for(;;); // Don't proceed, loop forever
          }
          display.clearDisplay();
          display.display();
          }
  
}