<header class="entry-header" style="overflow-wrap: break-word; color: #3a3a3a; font-family: &quot;Open Sans&quot;, sans-serif; font-size: 18px;">
   <h1 class="entry-title" itemprop="headline" style="border: 0px; margin: 0px; padding: 0px; font-family: inherit; font-size: 36px; font-style: inherit; line-height: 1.1em; display: var(--page-title-display);">ESP32 OLED Display with Arduino IDE</h1>
   </header>
<div class="entry-content" itemprop="text" data-content-ads-inserted="true" style="border: 0px; margin: 1.1em 0px 0px; padding: 0px; color: #3a3a3a; font-family: &quot;Open Sans&quot;, sans-serif; font-size: 18px;">
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">This guide shows how to use the 0.96 inch SSD1306 OLED display with ESP32 using Arduino IDE. We’ll show you how to write text, set different fonts, draw shapes and display bitmaps images.</p>
   <div class="wp-block-image" style="border: 0px; margin: 0px 0px 1.4em; padding: 0px;">
      <figure class="aligncenter" style="display: table; margin: 0px auto; clear: both;"><img loading="lazy" width="828" src="https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP32-Arduino-OLED-Display-Image.jpg?resize=828%2C466&amp;quality=100&amp;strip=all&amp;ssl=1" alt="ESP32 Arduino OLED Display Image circuit" class="wp-image-85469" srcset="https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP32-Arduino-OLED-Display-Image.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP32-Arduino-OLED-Display-Image.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP32-Arduino-OLED-Display-Image.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP32-Arduino-OLED-Display-Image.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w" sizes="(max-width: 828px) 100vw, 828px" data-recalc-dims="1" style="height: auto; max-width: 100%;" /></figure>
      </div>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">We also have a dedicated guide that shows how to<a href="https://randomnerdtutorials.com/esp32-esp8266-dht-temperature-and-humidity-oled-display/" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #1b78e2;" target="_blank">&nbsp;display temperature and humidity readings using DHT sensor and ESP32</a>.</p>
   <h2 style="border: 0px; margin: 34px 0px 18px; padding: 0px; font-family: inherit; font-size: 36px; font-style: inherit; line-height: 1.3em; position: relative;">Introducing 0.96 inch OLED Display</h2>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">The&nbsp;<a rel="noreferrer noopener" aria-label=" (opens in a new tab)" href="https://makeradvisor.com/tools/oled-display-128x64-0-96-inch/" target="_blank" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #1b78e2;">OLED display</a>&nbsp;that we’ll use in this tutorial is the SSD1306 model: a monocolor, 0.96 inch display with 128×64 pixels as shown in the following figure.</p>
   <div class="wp-block-image" data-slot-rendered-dynamic="true" style="border: 0px; margin: 0px 0px 1.4em; padding: 0px;">
      <figure class="aligncenter" style="display: table; margin: 0px auto; clear: both;"><img loading="lazy" width="750" src="https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2016/09/ssd1306-oled-display-arduino.jpg?resize=750%2C412&amp;quality=100&amp;strip=all&amp;ssl=1" alt="0.96 inch OLED display with ESP32 ESP8266 Arduino" class="wp-image-80990" srcset="https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2016/09/ssd1306-oled-display-arduino.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2016/09/ssd1306-oled-display-arduino.jpg?resize=300%2C165&amp;quality=100&amp;strip=all&amp;ssl=1 300w" sizes="(max-width: 750px) 100vw, 750px" data-recalc-dims="1" style="height: auto; max-width: 100%;" /></figure>
      </div>
   <div id="content_btf_wrapper" class="adunitwrapper content_btf_wrapper mv-size-0x0 native" data-wrapper="content_btf" style="border: 0px; margin: 10px auto 20px; padding: 0px; overflow: hidden; position: relative; height: 264px; width: 300px; text-align: center; max-width: 600px; min-height: 297px; visibility: hidden;">
      <div id="content_btf" class="content_btf adunit" style="border: 0px; margin: 0px; padding: 0px;">&nbsp;</div>
      <div class="adunitlabel" style="border: 0px; margin: 0px auto; padding: 0px; position: absolute; width: inherit; bottom: 0px; color: #a5a5a5; text-align: left; min-width: 160px; font-size: 12px !important; line-height: 12px !important;"><button class="mv-ad-report-button" data-target="content_btf" data-adtype="display" aria-label="Report this ad" style="font-family: &quot;Open Sans&quot;, sans-serif; font-size: 20px; line-height: 12px; margin: 0px; vertical-align: baseline; border-width: initial; border-style: none; border-color: initial; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; cursor: pointer; padding: 0px; color: #ffffff; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; float: right; position: relative; width: 300px; top: 0px; outline: none;"></button>
         <div class="mediavine" style="border: 0px; margin: 0px; padding: 0px;"><a href="https://www.mediavine.com/" target="_blank" rel="noopener" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #a5a5a5;"><img alt="Mediavine" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAAAUCAMAAAA0oWYGAAAANlBMVEUAAACkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKT0RuBeAAAAEXRSTlMAECAwQFBgcHuEj5+vv8/f7w0rGDcAAANcSURBVEjHzZbLlsMoDEQLMMYBPaj//9lZCDt2Oj1nZtesHCKbS0klwLFnACh9SwDQWkaM1Cj4I2OSDUAjtQAw8gUAyD6V9e9AcgA7SW6AktQEJPeMKQCaqqpKBoDDVNX2c1JVVW0k1PUsvRUAQLOIA4BNVVUK0FRUKwBsomIdaajoyEhdRaUAQFfRkZC6yjm0wUmyBSQTlAH9YgLMAQySJHcAyUiS/ZokSc6Mdv3wUXC+1AOyne/3a/IgSUH2kCa+ewBISnKW9c8agkmSc0G+ApIFOoFEeUN2ANtcUbHeN8i1nb7iznVJWa8bAAhJ1kCZZYXMbQV7RnpCxq9SSZKWZGHIBIQbLh5NpyZvSJ8+fVpaW/TYA7cH5NrZLME2CwLOErKR9BOSCiRZkEaSM8YIJblvS5SAHGjcPXyzIM9FbpBHziWXkhe9lLL7Eu0GeYreVlgD6krNByRf4YkTctZccsklLyUXJBekAJOyfSxS/Am5X+5rj4KY2w0yGTktdMoeBd+X3tnu6SZZcFdylru7b0qOpSTKtgI6yemkoMbDBemiotpPyHFV236DrCR186AakWZb5fOpJA39nm4TUbEd35Uctx7VSfqYtHSQIj+MY+kOOT4hB8kODaV3kiz59PJDSZ8kj3aH5Anzm5IPyNmMswp5/F/I7CQbDpKewrS1Lis/lRyNqzB+Qv4nJbkP0ia93iF9iIgej3RrNJcLcilTYhqD5OgkJX0qqauz3NM9RMT2S8n6r0pyjyYj2X43zgBQZzTOC1JJej/GOtgqSc7w+IeSM+X5hJz5q3F+VzI+cKS7cY6Ucsr5akE575M3/76Ajc+ufzZpz/hRk+Xsw+8WlFJKKYfTyJYXZP8FMuLqA3KamZnbFoaYFgTz1sxfd0i2q5jjfvVQ0q9GfKXbYwFdbx1L0bR9h2zhn8jIx7HI/ddjMVlk+3WMdWotaSu+KYnI14dxOKOk2deyCfMTUmITe1wJvlwwWG+QM46AdcF4G+p0VBh1poCc9wtGwepRzDjLM8Z1WkRgjtK+QzYz84piZg1J3XyPyTXcCup6VjnWVc3NfMfuZlavGavAy8183Y+yuLkWpOHmmgFkdXPJSOLvFWRZs68LSAkD/pkr+XuUPg8AqDozgPya/W8B/gPQAm/tWHkI8wAAAABJRU5ErkJggg==" style="height: 10px !important; max-width: 100%; border: 0px !important; margin: 0px !important; padding: 0px !important; box-shadow: none !important; width: 82px !important; min-width: 82px !important; min-height: 10px !important;" /></a></div>
         </div>
      </div>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">The OLED display doesn’t require backlight, which results in a very nice contrast in dark environments. Additionally, its pixels consume energy only when they are on, so the OLED display consumes less power when compared to other displays.</p>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">The model we’re using has four pins and communicates with any microcontroller using I2C communication protocol. There are models that come with an extra RESET pin or that communicate using SPI communication protocol.</p>
   <h2 style="border: 0px; margin: 34px 0px 18px; padding: 0px; font-family: inherit; font-size: 36px; font-style: inherit; line-height: 1.3em; position: relative;">OLED Display SSD1306 Pin Wiring</h2>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">Because the OLED display uses I2C communication protocol, wiring is very simple. You can use the following table as a reference.</p>
   <figure class="wp-block-table" style="margin: 0px 0px 1.4em; overflow-x: auto;">
      <table style="border-right: 0px solid rgba(0, 0, 0, 0.1); border-bottom: 0px solid rgba(0, 0, 0, 0.1); border-top-style: solid; border-left-style: solid; border-top-color: rgba(0, 0, 0, 0.1); border-left-color: rgba(0, 0, 0, 0.1); margin: 0px 0px 1.5em; padding: 0px; border-collapse: separate; border-spacing: 0px; width: 724px;">
         <tbody style="border: 0px; margin: 0px; padding: 0px;">
            <tr style="border: 0px; margin: 0px; padding: 0px;">
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;"><span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">Pin</span></td>
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;"><span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">ESP32</span></td>
               </tr>
            <tr style="border: 0px; margin: 0px; padding: 0px;">
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;">Vin</td>
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;"><span class="rnthl rntcred" style="border: 0px; margin: 0px; padding: 0px 4px; border-radius: 4px; color: #ffffff !important; display: inline-block; background-color: #cc3333;">3.3V</span></td>
               </tr>
            <tr style="border: 0px; margin: 0px; padding: 0px;">
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;">GND</td>
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;"><span class="rnthl rntcblack" style="border: 0px; margin: 0px; padding: 0px 4px; border-radius: 4px; color: #ffffff; display: inline-block; background-color: #333333;">GND</span></td>
               </tr>
            <tr style="border: 0px; margin: 0px; padding: 0px;">
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;">SCL</td>
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;"><span class="rnthl rntclgray" style="border: 0px; margin: 0px; padding: 0px 4px; border-radius: 4px; display: inline-block; background-color: #eeeeee;">GPIO 22</span></td>
               </tr>
            <tr style="border: 0px; margin: 0px; padding: 0px;">
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;">SDA</td>
               <td style="border-top: 0px solid rgba(0, 0, 0, 0.1); border-left: 0px solid rgba(0, 0, 0, 0.1); border-right-style: solid; border-bottom-style: solid; border-right-color: rgba(0, 0, 0, 0.1); border-bottom-color: rgba(0, 0, 0, 0.1); margin: 0px; padding: 8px;"><span class="rnthl rntcyellow" style="border: 0px; margin: 0px; padding: 0px 4px; border-radius: 4px; color: #ffffff; display: inline-block; background-color: #ffcc00;">GPIO 21</span></td>
               </tr>
            </tbody>
         </table>
      </figure>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">Alternatively, you can follow the next schematic diagram to wire the ESP32 to the OLED display.</p>
   <div class="wp-block-image" data-slot-rendered-dynamic="true" style="border: 0px; margin: 0px 0px 1.4em; padding: 0px;">
      <figure class="aligncenter" style="display: table; margin: 0px auto; clear: both;"><a href="https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP8266_oled_display_wiring.png?quality=100&amp;strip=all&amp;ssl=1" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #1b78e2;" target="_blank"><img loading="lazy" width="828" src="https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP32_OLED.png?resize=828%2C650&amp;quality=100&amp;strip=all&amp;ssl=1" alt="" class="wp-image-85566" srcset="https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP32_OLED.png?w=873&amp;quality=100&amp;strip=all&amp;ssl=1 873w, https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP32_OLED.png?resize=300%2C235&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP32_OLED.png?resize=768%2C603&amp;quality=100&amp;strip=all&amp;ssl=1 768w" sizes="(max-width: 828px) 100vw, 828px" data-recalc-dims="1" style="height: auto; max-width: 100%; border: 0px;" /></a></figure>
      </div>
   <div id="content_2_btf_wrapper" class="adunitwrapper content_btf_wrapper mv-size-0x0 native" data-wrapper="content_2_btf" style="border: 0px; margin: 10px auto 20px; padding: 0px; overflow: hidden; position: relative; height: 264px; width: 300px; text-align: center; max-width: 600px; min-height: 297px; visibility: hidden;">
      <div id="content_2_btf" class="content_btf adunit" style="border: 0px; margin: 0px; padding: 0px;">&nbsp;</div>
      <div class="adunitlabel" style="border: 0px; margin: 0px auto; padding: 0px; position: absolute; width: inherit; bottom: 0px; color: #a5a5a5; text-align: left; min-width: 160px; font-size: 12px !important; line-height: 12px !important;"><button class="mv-ad-report-button" data-target="content_2_btf" data-adtype="display" aria-label="Report this ad" style="font-family: &quot;Open Sans&quot;, sans-serif; font-size: 20px; line-height: 12px; margin: 0px; vertical-align: baseline; border-width: initial; border-style: none; border-color: initial; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; cursor: pointer; padding: 0px; color: #ffffff; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; float: right; position: relative; width: 300px; top: 0px; outline: none;"></button>
         <div class="mediavine" style="border: 0px; margin: 0px; padding: 0px;"><a href="https://www.mediavine.com/" target="_blank" rel="noopener" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #a5a5a5;"><img alt="Mediavine" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAAAUCAMAAAA0oWYGAAAANlBMVEUAAACkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKT0RuBeAAAAEXRSTlMAECAwQFBgcHuEj5+vv8/f7w0rGDcAAANcSURBVEjHzZbLlsMoDEQLMMYBPaj//9lZCDt2Oj1nZtesHCKbS0klwLFnACh9SwDQWkaM1Cj4I2OSDUAjtQAw8gUAyD6V9e9AcgA7SW6AktQEJPeMKQCaqqpKBoDDVNX2c1JVVW0k1PUsvRUAQLOIA4BNVVUK0FRUKwBsomIdaajoyEhdRaUAQFfRkZC6yjm0wUmyBSQTlAH9YgLMAQySJHcAyUiS/ZokSc6Mdv3wUXC+1AOyne/3a/IgSUH2kCa+ewBISnKW9c8agkmSc0G+ApIFOoFEeUN2ANtcUbHeN8i1nb7iznVJWa8bAAhJ1kCZZYXMbQV7RnpCxq9SSZKWZGHIBIQbLh5NpyZvSJ8+fVpaW/TYA7cH5NrZLME2CwLOErKR9BOSCiRZkEaSM8YIJblvS5SAHGjcPXyzIM9FbpBHziWXkhe9lLL7Eu0GeYreVlgD6krNByRf4YkTctZccsklLyUXJBekAJOyfSxS/Am5X+5rj4KY2w0yGTktdMoeBd+X3tnu6SZZcFdylru7b0qOpSTKtgI6yemkoMbDBemiotpPyHFV236DrCR186AakWZb5fOpJA39nm4TUbEd35Uctx7VSfqYtHSQIj+MY+kOOT4hB8kODaV3kiz59PJDSZ8kj3aH5Anzm5IPyNmMswp5/F/I7CQbDpKewrS1Lis/lRyNqzB+Qv4nJbkP0ia93iF9iIgej3RrNJcLcilTYhqD5OgkJX0qqauz3NM9RMT2S8n6r0pyjyYj2X43zgBQZzTOC1JJej/GOtgqSc7w+IeSM+X5hJz5q3F+VzI+cKS7cY6Ucsr5akE575M3/76Ajc+ufzZpz/hRk+Xsw+8WlFJKKYfTyJYXZP8FMuLqA3KamZnbFoaYFgTz1sxfd0i2q5jjfvVQ0q9GfKXbYwFdbx1L0bR9h2zhn8jIx7HI/ddjMVlk+3WMdWotaSu+KYnI14dxOKOk2deyCfMTUmITe1wJvlwwWG+QM46AdcF4G+p0VBh1poCc9wtGwepRzDjLM8Z1WkRgjtK+QzYz84piZg1J3XyPyTXcCup6VjnWVc3NfMfuZlavGavAy8183Y+yuLkWpOHmmgFkdXPJSOLvFWRZs68LSAkD/pkr+XuUPg8AqDozgPya/W8B/gPQAm/tWHkI8wAAAABJRU5ErkJggg==" style="height: 10px !important; max-width: 100%; border: 0px !important; margin: 0px !important; padding: 0px !important; box-shadow: none !important; width: 82px !important; min-width: 82px !important; min-height: 10px !important;" /></a></div>
         </div>
      </div>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">In this example, we’re using I2C communication protocol. The most suitable pins for I2C communication in the ESP32 are&nbsp;<span class="rnthl rntclgray" style="border: 0px; margin: 0px; padding: 0px 4px; border-radius: 4px; color: #000000 !important; display: inline-block; background-color: #eeeeee;">GPIO 22</span>&nbsp;(SCL) and&nbsp;<span class="rnthl rntcyellow" style="border: 0px; margin: 0px; padding: 0px 4px; border-radius: 4px; color: #ffffff; display: inline-block; background-color: #ffcc00;">GPIO 21</span>&nbsp;(SDA).</p>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">If you’re using an OLED display with SPI communication protocol, use the following GPIOs.</p>
   <ul style="border: 0px; margin: 0px 0px 1.5em 3em; padding: 0px; list-style: square;">
      <li style="border: 0px; margin: 0px; padding: 0px;">GPIO 18: CLK</li>
      <li style="border: 0px; margin: 0px; padding: 0px;">GPIO 19: MISO</li>
      <li style="border: 0px; margin: 0px; padding: 0px;">GPIO 23: MOSI</li>
      <li style="border: 0px; margin: 0px; padding: 0px;">GPIO 5: CS</li>
      </ul>
   <p class="rntbox rntclgreen" style="border: 0px; margin-bottom: 20px; padding: 10px; background-color: #009966; color: #ffffff !important;">Read our&nbsp;<a href="https://randomnerdtutorials.com/esp32-pinout-reference-gpios/" style="border: 0px; margin: 0px; padding: 0px; background-color: transparent; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; color: #ffffff;" target="_blank">ESP32 Pinout Reference Guide</a>&nbsp;to learn more about the ESP32 GPIOs.</p>
   <h2 style="border: 0px; margin: 34px 0px 18px; padding: 0px; font-family: inherit; font-size: 36px; font-style: inherit; line-height: 1.3em; position: relative;">Installing SSD1306 OLED Library – ESP32</h2>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">There are several libraries available to control the OLED display with the ESP32. In this tutorial we’ll use two Adafruit libraries:&nbsp;<a rel="noreferrer noopener" aria-label=" (opens in a new tab)" href="https://github.com/adafruit/Adafruit_SSD1306" target="_blank" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #1b78e2;">Adafruit_SSD1306 library</a>&nbsp;and&nbsp;<a rel="noreferrer noopener" aria-label=" (opens in a new tab)" href="https://github.com/adafruit/Adafruit-GFX-Library" target="_blank" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #1b78e2;">Adafruit_GFX library</a>.</p>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">Follow the next steps to install those libraries.</p>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">1. Open your Arduino IDE and go to&nbsp;<span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">Sketch&nbsp;</span>&gt;&nbsp;<span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">Include Library</span>&nbsp;&gt;&nbsp;<span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">Manage Libraries</span>. The Library Manager should open.</p>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">2. Type “<span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">SSD1306</span>” in the search box and install the SSD1306 library from Adafruit.</p>
   <div class="wp-block-image" data-slot-rendered-dynamic="true" style="border: 0px; margin: 0px 0px 1.4em; padding: 0px;">
      <figure class="aligncenter" style="display: table; margin: 0px auto; clear: both;"><img loading="lazy" width="788" src="https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/install-ssd1306-adafruit-library.png?resize=788%2C443&amp;quality=100&amp;strip=all&amp;ssl=1" alt="" class="wp-image-85156" srcset="https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/install-ssd1306-adafruit-library.png?w=788&amp;quality=100&amp;strip=all&amp;ssl=1 788w, https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/install-ssd1306-adafruit-library.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/install-ssd1306-adafruit-library.png?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w" sizes="(max-width: 788px) 100vw, 788px" data-recalc-dims="1" style="height: auto; max-width: 100%;" /></figure>
      </div>
   <div id="content_3_btf_wrapper" class="adunitwrapper content_btf_wrapper mv-size-0x0 native" data-wrapper="content_3_btf" style="border: 0px; margin: 10px auto 20px; padding: 0px; overflow: hidden; position: relative; height: 264px; width: 300px; text-align: center; max-width: 600px; min-height: 297px; visibility: hidden;">
      <div id="content_3_btf" class="content_btf adunit" style="border: 0px; margin: 0px; padding: 0px;">&nbsp;</div>
      <div class="adunitlabel" style="border: 0px; margin: 0px auto; padding: 0px; position: absolute; width: inherit; bottom: 0px; color: #a5a5a5; text-align: left; min-width: 160px; font-size: 12px !important; line-height: 12px !important;"><button class="mv-ad-report-button" data-target="content_3_btf" data-adtype="display" aria-label="Report this ad" style="font-family: &quot;Open Sans&quot;, sans-serif; font-size: 20px; line-height: 12px; margin: 0px; vertical-align: baseline; border-width: initial; border-style: none; border-color: initial; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; cursor: pointer; padding: 0px; color: #ffffff; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; float: right; position: relative; width: 300px; top: 0px; outline: none;"></button>
         <div class="mediavine" style="border: 0px; margin: 0px; padding: 0px;"><a href="https://www.mediavine.com/" target="_blank" rel="noopener" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #a5a5a5;"><img alt="Mediavine" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAAAUCAMAAAA0oWYGAAAANlBMVEUAAACkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKT0RuBeAAAAEXRSTlMAECAwQFBgcHuEj5+vv8/f7w0rGDcAAANcSURBVEjHzZbLlsMoDEQLMMYBPaj//9lZCDt2Oj1nZtesHCKbS0klwLFnACh9SwDQWkaM1Cj4I2OSDUAjtQAw8gUAyD6V9e9AcgA7SW6AktQEJPeMKQCaqqpKBoDDVNX2c1JVVW0k1PUsvRUAQLOIA4BNVVUK0FRUKwBsomIdaajoyEhdRaUAQFfRkZC6yjm0wUmyBSQTlAH9YgLMAQySJHcAyUiS/ZokSc6Mdv3wUXC+1AOyne/3a/IgSUH2kCa+ewBISnKW9c8agkmSc0G+ApIFOoFEeUN2ANtcUbHeN8i1nb7iznVJWa8bAAhJ1kCZZYXMbQV7RnpCxq9SSZKWZGHIBIQbLh5NpyZvSJ8+fVpaW/TYA7cH5NrZLME2CwLOErKR9BOSCiRZkEaSM8YIJblvS5SAHGjcPXyzIM9FbpBHziWXkhe9lLL7Eu0GeYreVlgD6krNByRf4YkTctZccsklLyUXJBekAJOyfSxS/Am5X+5rj4KY2w0yGTktdMoeBd+X3tnu6SZZcFdylru7b0qOpSTKtgI6yemkoMbDBemiotpPyHFV236DrCR186AakWZb5fOpJA39nm4TUbEd35Uctx7VSfqYtHSQIj+MY+kOOT4hB8kODaV3kiz59PJDSZ8kj3aH5Anzm5IPyNmMswp5/F/I7CQbDpKewrS1Lis/lRyNqzB+Qv4nJbkP0ia93iF9iIgej3RrNJcLcilTYhqD5OgkJX0qqauz3NM9RMT2S8n6r0pyjyYj2X43zgBQZzTOC1JJej/GOtgqSc7w+IeSM+X5hJz5q3F+VzI+cKS7cY6Ucsr5akE575M3/76Ajc+ufzZpz/hRk+Xsw+8WlFJKKYfTyJYXZP8FMuLqA3KamZnbFoaYFgTz1sxfd0i2q5jjfvVQ0q9GfKXbYwFdbx1L0bR9h2zhn8jIx7HI/ddjMVlk+3WMdWotaSu+KYnI14dxOKOk2deyCfMTUmITe1wJvlwwWG+QM46AdcF4G+p0VBh1poCc9wtGwepRzDjLM8Z1WkRgjtK+QzYz84piZg1J3XyPyTXcCup6VjnWVc3NfMfuZlavGavAy8183Y+yuLkWpOHmmgFkdXPJSOLvFWRZs68LSAkD/pkr+XuUPg8AqDozgPya/W8B/gPQAm/tWHkI8wAAAABJRU5ErkJggg==" style="height: 10px !important; max-width: 100%; border: 0px !important; margin: 0px !important; padding: 0px !important; box-shadow: none !important; width: 82px !important; min-width: 82px !important; min-height: 10px !important;" /></a></div>
         </div>
      </div>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">3. After installing the SSD1306 library from Adafruit, type “<span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">GFX</span>” in the search box and install the library.</p>
   <div class="wp-block-image" style="border: 0px; margin: 0px 0px 1.4em; padding: 0px;">
      <figure class="aligncenter" style="display: table; margin: 0px auto; clear: both;"><img loading="lazy" width="786" src="https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/install-gfx-library-adafruit.png?resize=786%2C443&amp;quality=100&amp;strip=all&amp;ssl=1" alt="Installing GFX Library ESP8266 ESP32 Arduino" class="wp-image-85157" srcset="https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/install-gfx-library-adafruit.png?w=786&amp;quality=100&amp;strip=all&amp;ssl=1 786w, https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/install-gfx-library-adafruit.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/install-gfx-library-adafruit.png?resize=768%2C433&amp;quality=100&amp;strip=all&amp;ssl=1 768w" sizes="(max-width: 786px) 100vw, 786px" data-recalc-dims="1" style="height: auto; max-width: 100%;" /></figure>
      </div>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">4. After installing the libraries, restart your Arduino IDE.</p>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">We’ll program the ESP32 using Arduino IDE, so you must have the ESP32 add-on installed in your Arduino IDE. If you haven’t, follow the next tutorial first:</p>
   <ul style="border: 0px; margin: 0px 0px 1.5em 3em; padding: 0px; list-style: square;">
      <li style="border: 0px; margin: 0px; padding: 0px;"><a href="https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #1b78e2;" target="_blank">Install the ESP32 Board in Arduino IDE (Windows instructions)</a></li>
      <li style="border: 0px; margin: 0px; padding: 0px;"><a href="https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-mac-and-linux-instructions/" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #1b78e2;" target="_blank">Install the ESP32 Board in Arduino IDE (Mac OS X and Linux instructions)</a></li>
      </ul>
   <h2 style="border: 0px; margin: 34px 0px 18px; padding: 0px; font-family: inherit; font-size: 36px; font-style: inherit; line-height: 1.3em; position: relative;">Testing OLED Display with ESP32</h2>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">After wiring the OLED display to the ESP32 and installing all required libraries, you can use one example from the library to see if everything is working properly.</p>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">In your Arduino IDE, go to&nbsp;<span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">File</span>&nbsp;&gt;&nbsp;<span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">Examples&nbsp;</span>&gt;&nbsp;<span style="border: 0px; margin: 0px; padding: 0px; font-weight: 700;">Adafruit SSD1306</span>&nbsp;and select the example for the display you’re using.</p>
   <div class="wp-block-image" data-slot-rendered-dynamic="true" style="border: 0px; margin: 0px 0px 1.4em; padding: 0px;">
      <figure class="aligncenter" style="display: table; margin: 0px auto; clear: both;"><img loading="lazy" width="624" src="https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/oled_example_esp8266.png?resize=624%2C598&amp;quality=100&amp;strip=all&amp;ssl=1" alt="Testing Adafruit SSD1306 Library example" class="wp-image-85166" srcset="https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/oled_example_esp8266.png?w=624&amp;quality=100&amp;strip=all&amp;ssl=1 624w, https://i1.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/oled_example_esp8266.png?resize=300%2C288&amp;quality=100&amp;strip=all&amp;ssl=1 300w" sizes="(max-width: 624px) 100vw, 624px" data-recalc-dims="1" style="height: auto; max-width: 100%;" /></figure>
      </div>
   <div id="content_4_btf_wrapper" class="adunitwrapper content_btf_wrapper mv-size-0x0 native" data-wrapper="content_4_btf" style="border: 0px; margin: 10px auto 20px; padding: 0px; overflow: hidden; position: relative; height: 264px; width: 300px; text-align: center; max-width: 600px; min-height: 297px; visibility: hidden;">
      <div id="content_4_btf" class="content_btf adunit" style="border: 0px; margin: 0px; padding: 0px;">&nbsp;</div>
      <div class="adunitlabel" style="border: 0px; margin: 0px auto; padding: 0px; position: absolute; width: inherit; bottom: 0px; color: #a5a5a5; text-align: left; min-width: 160px; font-size: 12px !important; line-height: 12px !important;"><button class="mv-ad-report-button" data-target="content_4_btf" data-adtype="display" aria-label="Report this ad" style="font-family: &quot;Open Sans&quot;, sans-serif; font-size: 20px; line-height: 12px; margin: 0px; vertical-align: baseline; border-width: initial; border-style: none; border-color: initial; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; cursor: pointer; padding: 0px; color: #ffffff; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; float: right; position: relative; width: 300px; top: 0px; outline: none;"></button>
         <div class="mediavine" style="border: 0px; margin: 0px; padding: 0px;"><a href="https://www.mediavine.com/" target="_blank" rel="noopener" style="border: 0px; margin: 0px; padding: 0px; transition: color 0.1s ease-in-out 0s, background-color 0.1s ease-in-out 0s; text-decoration-line: none; color: #a5a5a5;"><img alt="Mediavine" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAAAUCAMAAAA0oWYGAAAANlBMVEUAAACkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKT0RuBeAAAAEXRSTlMAECAwQFBgcHuEj5+vv8/f7w0rGDcAAANcSURBVEjHzZbLlsMoDEQLMMYBPaj//9lZCDt2Oj1nZtesHCKbS0klwLFnACh9SwDQWkaM1Cj4I2OSDUAjtQAw8gUAyD6V9e9AcgA7SW6AktQEJPeMKQCaqqpKBoDDVNX2c1JVVW0k1PUsvRUAQLOIA4BNVVUK0FRUKwBsomIdaajoyEhdRaUAQFfRkZC6yjm0wUmyBSQTlAH9YgLMAQySJHcAyUiS/ZokSc6Mdv3wUXC+1AOyne/3a/IgSUH2kCa+ewBISnKW9c8agkmSc0G+ApIFOoFEeUN2ANtcUbHeN8i1nb7iznVJWa8bAAhJ1kCZZYXMbQV7RnpCxq9SSZKWZGHIBIQbLh5NpyZvSJ8+fVpaW/TYA7cH5NrZLME2CwLOErKR9BOSCiRZkEaSM8YIJblvS5SAHGjcPXyzIM9FbpBHziWXkhe9lLL7Eu0GeYreVlgD6krNByRf4YkTctZccsklLyUXJBekAJOyfSxS/Am5X+5rj4KY2w0yGTktdMoeBd+X3tnu6SZZcFdylru7b0qOpSTKtgI6yemkoMbDBemiotpPyHFV236DrCR186AakWZb5fOpJA39nm4TUbEd35Uctx7VSfqYtHSQIj+MY+kOOT4hB8kODaV3kiz59PJDSZ8kj3aH5Anzm5IPyNmMswp5/F/I7CQbDpKewrS1Lis/lRyNqzB+Qv4nJbkP0ia93iF9iIgej3RrNJcLcilTYhqD5OgkJX0qqauz3NM9RMT2S8n6r0pyjyYj2X43zgBQZzTOC1JJej/GOtgqSc7w+IeSM+X5hJz5q3F+VzI+cKS7cY6Ucsr5akE575M3/76Ajc+ufzZpz/hRk+Xsw+8WlFJKKYfTyJYXZP8FMuLqA3KamZnbFoaYFgTz1sxfd0i2q5jjfvVQ0q9GfKXbYwFdbx1L0bR9h2zhn8jIx7HI/ddjMVlk+3WMdWotaSu+KYnI14dxOKOk2deyCfMTUmITe1wJvlwwWG+QM46AdcF4G+p0VBh1poCc9wtGwepRzDjLM8Z1WkRgjtK+QzYz84piZg1J3XyPyTXcCup6VjnWVc3NfMfuZlavGavAy8183Y+yuLkWpOHmmgFkdXPJSOLvFWRZs68LSAkD/pkr+XuUPg8AqDozgPya/W8B/gPQAm/tWHkI8wAAAABJRU5ErkJggg==" style="height: 10px !important; max-width: 100%; border: 0px !important; margin: 0px !important; padding: 0px !important; box-shadow: none !important; width: 82px !important; min-width: 82px !important; min-height: 10px !important;" /></a></div>
         </div>
      </div>
   <p style="border: 0px; margin-bottom: 1.4em; padding: 0px;">The following code should load:</p>
   <pre class=" language-c" style="border: 0px; margin-top: 0.5em; margin-bottom: 20px; padding: 1em; background: rgb(245, 242, 240); font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: inherit; line-height: 1.5; overflow: auto; max-width: 100%; color: #000000; text-shadow: rgb(255, 255, 255) 0px 1px; word-spacing: normal; word-break: normal; overflow-wrap: normal; tab-size: 4; hyphens: none; max-height: 40em;">
      <code class=" language-c" style="border: 0px; margin: 0px; padding: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 15px; line-height: 1.5; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; background: 0px 0px; text-shadow: rgb(255, 255, 255) 0px 1px; word-spacing: normal; word-break: normal; overflow-wrap: normal; tab-size: 4; hyphens: none;"><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">/*********
  Complete project details at https://randomnerdtutorials.com
  This is an example for our Monochrome OLEDs based on SSD1306 drivers. Pick one up today in the adafruit shop! ------&gt; http://www.adafruit.com/category/63_98
  This example is for a 128x32 pixel display using I2C to communicate 3 pins are required to interface (two I2C and one reset).
  Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
  Written by Limor Fried/Ladyada for Adafruit Industries, with contributions from the open source community. BSD license, check license.txt for more information All text above, and the splash screen below must be included in any redistribution. 
*********/</span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">include</span><span class="token string" style="border: 0px; margin: 0px; padding: 0px; color: #669900;">&lt;SPI.h&gt;</span></span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">include</span><span class="token string" style="border: 0px; margin: 0px; padding: 0px; color: #669900;">&lt;Wire.h&gt;</span></span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">include</span><span class="token string" style="border: 0px; margin: 0px; padding: 0px; color: #669900;">&lt;Adafruit_GFX.h&gt;</span></span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">include</span><span class="token string" style="border: 0px; margin: 0px; padding: 0px; color: #669900;">&lt;Adafruit_SSD1306.h&gt;</span></span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">define</span> SCREEN_WIDTH 128 </span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// OLED display width, in pixels</span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">define</span> SCREEN_HEIGHT 64 </span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// OLED display height, in pixels</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)</span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">define</span> OLED_RESET     -1 </span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Reset pin # (or -1 if sharing Arduino reset pin)</span>
Adafruit_SSD1306 <span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">display</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span>SCREEN_WIDTH<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> SCREEN_HEIGHT<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span><span class="token operator" style="border: 0px; margin: 0px; padding: 0px; color: #9a6e3a; background: rgba(255, 255, 255, 0.5);">&amp;</span>Wire<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> OLED_RESET<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">define</span> NUMFLAKES     10 </span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Number of snowflakes in the animation example</span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">define</span> LOGO_HEIGHT   16</span><span class="token macro property" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">#<span class="token directive keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">define</span> LOGO_WIDTH    16</span><span class="token keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">static</span><span class="token keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">const</span><span class="token keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">unsigned</span><span class="token keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">char</span> PROGMEM logo_bmp<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">[</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">]</span><span class="token operator" style="border: 0px; margin: 0px; padding: 0px; color: #9a6e3a; background: rgba(255, 255, 255, 0.5);">=</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">{</span> B00000000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11000000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00000001<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11000000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00000001<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11000000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00000011<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11100000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B11110011<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11100000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B11111110<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11111000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B01111110<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11111111<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00110011<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B10011111<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00011111<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11111100<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00001101<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B01110000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00011011<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B10100000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00111111<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11100000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00111111<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11110000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B01111100<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B11110000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B01110000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B01110000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span>
  B00000000<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> B00110000 <span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">}</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">void</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">setup</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">{</span>
  Serial<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">.</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">begin</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token number" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">115200</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally</span><span class="token keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">if</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token operator" style="border: 0px; margin: 0px; padding: 0px; color: #9a6e3a; background: rgba(255, 255, 255, 0.5);">!</span>display<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">.</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">begin</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span>SSD1306_SWITCHCAPVCC<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span><span class="token number" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">0x3C</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">{</span> 
    Serial<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">.</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">println</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">F</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token string" style="border: 0px; margin: 0px; padding: 0px; color: #669900;">"SSD1306 allocation failed"</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token keyword" style="border: 0px; margin: 0px; padding: 0px; color: #0077aa;">for</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Don't proceed, loop forever</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">}</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Show initial display buffer contents on the screen --</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// the library initializes this with an Adafruit splash screen.</span>
  display<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">.</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">display</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">delay</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token number" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">2000</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Pause for 2 seconds</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Clear the buffer</span>
  display<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">.</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">clearDisplay</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw a single pixel in white</span>
  display<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">.</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">drawPixel</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token number" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">10</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span><span class="token number" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">10</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">,</span> WHITE<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Show the display buffer on the screen. You MUST call display() after</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// drawing commands to make them visible on screen!</span>
  display<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">.</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">display</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">delay</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token number" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">2000</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// display.display() is NOT necessary after every single drawing command,</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// unless that's what you want...rather, you can batch up a bunch of</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// drawing operations and then update the screen all at once by calling</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// display.display(). These examples demonstrate both approaches...</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testdrawline</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw many lines</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testdrawrect</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw rectangles (outlines)</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testfillrect</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw rectangles (filled)</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testdrawcircle</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw circles (outlines)</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testfillcircle</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw circles (filled)</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testdrawroundrect</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw rounded rectangles (outlines)</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testfillroundrect</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw rounded rectangles (filled)</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testdrawtriangle</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw triangles (outlines)</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testfilltriangle</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw triangles (filled)</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testdrawchar</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw characters of the default font</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testdrawstyles</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw 'stylized' characters</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testscrolltext</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw scrolling text</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">testdrawbitmap</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Draw a small bitmap image</span><span class="token comment" style="border: 0px; margin: 0px; padding: 0px; list-style-type: none; color: #708090;">// Invert and restore display, pausing in-between</span>
  display<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">.</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">invertDisplay</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span>true<span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">;</span><span class="token function" style="border: 0px; margin: 0px; padding: 0px; color: #dd4a68;">delay</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">(</span><span class="token number" style="border: 0px; margin: 0px; padding: 0px; color: #990055;">1000</span><span class="token punctuation" style="border: 0px; margin: 0px; padding: 0px; color: #999999;">)</span></code>
      </pre>
   </d