{"id":132900,"date":"2023-12-07T15:02:09","date_gmt":"2023-12-07T15:02:09","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=132900"},"modified":"2024-05-06T10:54:12","modified_gmt":"2024-05-06T10:54:12","slug":"raspberry-pi-pico-ssd1306-oled-micropython","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-ssd1306-oled-micropython\/","title":{"rendered":"Raspberry Pi Pico: SSD1306 OLED Display (MicroPython)"},"content":{"rendered":"\n<p>This guide shows how to use the SSD1306 OLED display with the Raspberry Pi Pico programmed with MicroPython firmware. You&#8217;ll learn how to display text and other useful functions to interact with the OLED display.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-MicroPython.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico:SSD1306 OLED Display MicroPython\" class=\"wp-image-132903\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-MicroPython.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-MicroPython.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-MicroPython.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-MicroPython.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p class=\"rntbox rntclgray\">We have a similar tutorial using Raspberry Pi Pico with Arduino IDE: <a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-ssd1306-oled-arduino\/\" title=\"\">Raspberry Pi Pico: SSD1306 OLED Display (Arduino IDE)<\/a>.<\/p>\n\n\n\n<p><strong>Table of Contents<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#intro-oled\" title=\"\">Introducing the OLED Display<\/a><\/li>\n\n\n\n<li><a href=\"#raspberry-pi-pico-oled-wiring\" title=\"\">Wire the OLED to the Raspberry Pi Pico<\/a><\/li>\n\n\n\n<li><a href=\"#install-libraries\" title=\"\">Installing Libraries<\/a><\/li>\n\n\n\n<li><a href=\"#write-text\" title=\"\">Write Text to the OLED Display<\/a><\/li>\n\n\n\n<li><a href=\"#other-oled-functions\" title=\"\">Other Useful OLED Functions<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites &#8211; MicroPython Firmware<\/h2>\n\n\n\n<p>To follow this tutorial you need MicroPython firmware installed in your Raspberry Pi Pico board. You also need an IDE to write and upload the code to your board. <\/p>\n\n\n\n<p>The recommended MicroPython IDE for the Raspberry Pi Pico is Thonny IDE. Follow the next tutorial to learn how to install Thonny IDE, flash MicroPython firmware, and upload code to the board.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-raspberry-pi-pico-w\/#install-thonny-ide\" title=\"\">Programming Raspberry Pi Pico using MicroPython<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"intro-oled\">Introducing 0.96 inch OLED Display<\/h2>\n\n\n\n<p>The <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/oled-display-128x64-0-96-inch\/\" target=\"_blank\">OLED display<\/a> that we\u2019ll use in this tutorial is the SSD1306 model: a monocolor, 0.96 inch display with 128\u00d764 pixels as shown in the following figure.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"412\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/09\/ssd1306-oled-display-arduino.jpg?resize=750%2C412&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"0.96 inch OLED display with ESP32 ESP8266 Arduino\" class=\"wp-image-80990\" srcset=\"https:\/\/i0.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:\/\/i0.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\" \/><\/figure><\/div>\n\n\n<p>The OLED display doesn\u2019t 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>\n\n\n\n<p>The model we\u2019re 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>\n\n\n\n<h2 class=\"wp-block-heading\">Parts Required<\/h2>\n\n\n\n<p>Here\u2019s a list of parts you need for this project:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/oled-display-128x64-0-96-inch\/\" target=\"_blank\">0.96 inch OLED display&nbsp;<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/raspberry-pi-pico-w\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Raspberry Pi Pico<\/a><\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\">Breadboard<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\" rel=\"noreferrer noopener\">Jumper wires<\/a><\/li>\n<\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-pico-oled-wiring\">OLED Display SSD1306 Pin Wiring<\/h2>\n\n\n\n<p>The OLED display uses I2C communication protocol, so wiring is pretty straightforward. You can use the following table as a reference. We&#8217;re using <span class=\"rnthl rntcyellow\">GPIO 4<\/span> (SDA) and <span class=\"rnthl rntclgray\">GPIO 5<\/span> (SCL) as I2C pins, but you can use any other pair of I2C pins (make sure you check the Raspberry Pi Pico pinout diagram).<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Pin<\/strong><\/td><td><strong>Raspberry Pi Pico<\/strong><\/td><\/tr><tr><td>Vin<\/td><td><span class=\"rnthl rntcred\">3.3V<\/span>(OUT)<\/td><\/tr><tr><td>GND<\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><\/tr><tr><td>SCL<\/td><td><span class=\"rnthl rntclgray\">GPIO 5<\/span><\/td><\/tr><tr><td>SDA<\/td><td><span class=\"rnthl rntcyellow\">GPIO 4<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You can also use the following schematic diagram as a reference.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-Fritzing-Diagram.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"388\" height=\"750\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-Fritzing-Diagram.png?resize=388%2C750&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico with OLED Display Diagram Fritzing\" class=\"wp-image-132810\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-Fritzing-Diagram.png?w=388&amp;quality=100&amp;strip=all&amp;ssl=1 388w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-Fritzing-Diagram.png?resize=155%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 155w\" sizes=\"(max-width: 388px) 100vw, 388px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"install-libraries\">SSD1306 OLED Library<\/h2>\n\n\n\n<p>The library to write to the OLED display isn\u2019t part of the standard MicroPython library by default. So, you need to upload the library to your Raspberry Pi Pico board.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># MicroPython SSD1306 OLED driver, I2C and SPI interfaces created by Adafruit\n\nimport time\nimport framebuf\n\n# register definitions\nSET_CONTRAST        = const(0x81)\nSET_ENTIRE_ON       = const(0xa4)\nSET_NORM_INV        = const(0xa6)\nSET_DISP            = const(0xae)\nSET_MEM_ADDR        = const(0x20)\nSET_COL_ADDR        = const(0x21)\nSET_PAGE_ADDR       = const(0x22)\nSET_DISP_START_LINE = const(0x40)\nSET_SEG_REMAP       = const(0xa0)\nSET_MUX_RATIO       = const(0xa8)\nSET_COM_OUT_DIR     = const(0xc0)\nSET_DISP_OFFSET     = const(0xd3)\nSET_COM_PIN_CFG     = const(0xda)\nSET_DISP_CLK_DIV    = const(0xd5)\nSET_PRECHARGE       = const(0xd9)\nSET_VCOM_DESEL      = const(0xdb)\nSET_CHARGE_PUMP     = const(0x8d)\n\n\nclass SSD1306:\n    def __init__(self, width, height, external_vcc):\n        self.width = width\n        self.height = height\n        self.external_vcc = external_vcc\n        self.pages = self.height \/\/ 8\n        # Note the subclass must initialize self.framebuf to a framebuffer.\n        # This is necessary because the underlying data buffer is different\n        # between I2C and SPI implementations (I2C needs an extra byte).\n        self.poweron()\n        self.init_display()\n\n    def init_display(self):\n        for cmd in (\n            SET_DISP | 0x00, # off\n            # address setting\n            SET_MEM_ADDR, 0x00, # horizontal\n            # resolution and layout\n            SET_DISP_START_LINE | 0x00,\n            SET_SEG_REMAP | 0x01, # column addr 127 mapped to SEG0\n            SET_MUX_RATIO, self.height - 1,\n            SET_COM_OUT_DIR | 0x08, # scan from COM[N] to COM0\n            SET_DISP_OFFSET, 0x00,\n            SET_COM_PIN_CFG, 0x02 if self.height == 32 else 0x12,\n            # timing and driving scheme\n            SET_DISP_CLK_DIV, 0x80,\n            SET_PRECHARGE, 0x22 if self.external_vcc else 0xf1,\n            SET_VCOM_DESEL, 0x30, # 0.83*Vcc\n            # display\n            SET_CONTRAST, 0xff, # maximum\n            SET_ENTIRE_ON, # output follows RAM contents\n            SET_NORM_INV, # not inverted\n            # charge pump\n            SET_CHARGE_PUMP, 0x10 if self.external_vcc else 0x14,\n            SET_DISP | 0x01): # on\n            self.write_cmd(cmd)\n        self.fill(0)\n        self.show()\n\n    def poweroff(self):\n        self.write_cmd(SET_DISP | 0x00)\n\n    def contrast(self, contrast):\n        self.write_cmd(SET_CONTRAST)\n        self.write_cmd(contrast)\n\n    def invert(self, invert):\n        self.write_cmd(SET_NORM_INV | (invert &amp; 1))\n\n    def show(self):\n        x0 = 0\n        x1 = self.width - 1\n        if self.width == 64:\n            # displays with width of 64 pixels are shifted by 32\n            x0 += 32\n            x1 += 32\n        self.write_cmd(SET_COL_ADDR)\n        self.write_cmd(x0)\n        self.write_cmd(x1)\n        self.write_cmd(SET_PAGE_ADDR)\n        self.write_cmd(0)\n        self.write_cmd(self.pages - 1)\n        self.write_framebuf()\n\n    def fill(self, col):\n        self.framebuf.fill(col)\n\n    def pixel(self, x, y, col):\n        self.framebuf.pixel(x, y, col)\n\n    def scroll(self, dx, dy):\n        self.framebuf.scroll(dx, dy)\n\n    def text(self, string, x, y, col=1):\n        self.framebuf.text(string, x, y, col)\n\n\nclass SSD1306_I2C(SSD1306):\n    def __init__(self, width, height, i2c, addr=0x3c, external_vcc=False):\n        self.i2c = i2c\n        self.addr = addr\n        self.temp = bytearray(2)\n        # Add an extra byte to the data buffer to hold an I2C data\/command byte\n        # to use hardware-compatible I2C transactions.  A memoryview of the\n        # buffer is used to mask this byte from the framebuffer operations\n        # (without a major memory hit as memoryview doesn't copy to a separate\n        # buffer).\n        self.buffer = bytearray(((height \/\/ 8) * width) + 1)\n        self.buffer[0] = 0x40  # Set first byte of data buffer to Co=0, D\/C=1\n        self.framebuf = framebuf.FrameBuffer1(memoryview(self.buffer)[1:], width, height)\n        super().__init__(width, height, external_vcc)\n\n    def write_cmd(self, cmd):\n        self.temp[0] = 0x80 # Co=1, D\/C#=0\n        self.temp[1] = cmd\n        self.i2c.writeto(self.addr, self.temp)\n\n    def write_framebuf(self):\n        # Blast out the frame buffer using a single I2C transaction to support\n        # hardware I2C interfaces.\n        self.i2c.writeto(self.addr, self.buffer)\n\n    def poweron(self):\n        pass\n\n\nclass SSD1306_SPI(SSD1306):\n    def __init__(self, width, height, spi, dc, res, cs, external_vcc=False):\n        self.rate = 10 * 1024 * 1024\n        dc.init(dc.OUT, value=0)\n        res.init(res.OUT, value=0)\n        cs.init(cs.OUT, value=1)\n        self.spi = spi\n        self.dc = dc\n        self.res = res\n        self.cs = cs\n        self.buffer = bytearray((height \/\/ 8) * width)\n        self.framebuf = framebuf.FrameBuffer1(self.buffer, width, height)\n        super().__init__(width, height, external_vcc)\n\n    def write_cmd(self, cmd):\n        self.spi.init(baudrate=self.rate, polarity=0, phase=0)\n        self.cs.high()\n        self.dc.low()\n        self.cs.low()\n        self.spi.write(bytearray([cmd]))\n        self.cs.high()\n\n    def write_framebuf(self):\n        self.spi.init(baudrate=self.rate, polarity=0, phase=0)\n        self.cs.high()\n        self.dc.high()\n        self.cs.low()\n        self.spi.write(self.buffer)\n        self.cs.high()\n\n    def poweron(self):\n        self.res.high()\n        time.sleep_ms(1)\n        self.res.low()\n        time.sleep_ms(10)\n        self.res.high()\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/ESP-MicroPython\/raw\/master\/code\/Others\/OLED\/ssd1306.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>Follow the next steps to upload the library file to the Raspberry Pi Pico.<\/p>\n\n\n\n<p><strong>1.<\/strong> Create a new file in Thonny IDE and copy the library code. The <a aria-label=\" (opens in a new tab)\" href=\"https:\/\/raw.githubusercontent.com\/RuiSantosdotme\/ESP-MicroPython\/master\/code\/Others\/OLED\/ssd1306.py\" target=\"_blank\" rel=\"noreferrer noopener\">OLED library code can be found here<\/a>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"679\" height=\"768\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/ssd1306-micropython-library-file.jpg?resize=679%2C768&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"SSD1306 micropython library file\" class=\"wp-image-132904\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/ssd1306-micropython-library-file.jpg?w=679&amp;quality=100&amp;strip=all&amp;ssl=1 679w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/ssd1306-micropython-library-file.jpg?resize=265%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 265w\" sizes=\"(max-width: 679px) 100vw, 679px\" \/><\/figure><\/div>\n\n\n<p><strong>2<\/strong>. Go to <strong>File <\/strong>&gt; <strong>Save <\/strong>as and select <strong>Raspberry Pi Pico<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"214\" height=\"203\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Save-file-to-Raspberry-Pi-Pico.png?resize=214%2C203&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Save Files to Raspberry Pi Pico Thonny IDE\" class=\"wp-image-130899\"\/><\/figure><\/div>\n\n\n<p><strong>3.<\/strong> Name the file <em>ssd1306.py<\/em> and click <strong>OK <\/strong>to save the file on the Raspberry Pi Pico.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"545\" height=\"327\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/saving-ssd1306-library-file-thonny-ide-raspberry-pi-pico.jpg?resize=545%2C327&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"save the ssd1306 oled library micropython\" class=\"wp-image-132905\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/saving-ssd1306-library-file-thonny-ide-raspberry-pi-pico.jpg?w=545&amp;quality=100&amp;strip=all&amp;ssl=1 545w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/saving-ssd1306-library-file-thonny-ide-raspberry-pi-pico.jpg?resize=300%2C180&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><\/figure><\/div>\n\n\n<p>And that&#8217;s it. The library was uploaded to your board. Now, you can use the library functionalities in your code by importing the library. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i2c-scanner\">Finding the OLED I2C Address<\/h2>\n\n\n\n<p>By default, the OLED library we&#8217;re using will assume that your OLED I2C address is 0x3c. For most I2C SSD1306 displays, that will be their address. However, some displays might have a different address, so it&#8217;s <em>important to check the I2C address<\/em> before continuing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">I2C Scanner &#8211; MicroPython<\/h3>\n\n\n\n<p>Open Thonny IDE, or the IDE of your choice, and copy the following code.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># I2C Scanner MicroPython\nfrom machine import Pin, SoftI2C\n\n# You can choose any other combination of I2C pins\ni2c = SoftI2C(scl=Pin(5), sda=Pin(4))\n\nprint('I2C SCANNER')\ndevices = i2c.scan()\n\nif len(devices) == 0:\n  print(&quot;No i2c device !&quot;)\nelse:\n  print('i2c devices found:', len(devices))\n\n  for device in devices:\n    print(&quot;I2C hexadecimal address: &quot;, hex(device))\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/Raspberry-Pi-Pico\/MicroPython\/I2C_Scanner.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>After copying the code:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>connect the Raspberry Pi Pico to your computer, if it isn&#8217;t already;<\/li>\n\n\n\n<li>make sure you have the OLED display properly connected to your board on the right I2C pins (SCL=GPIO5 ; SDA =GPIO4).<\/li>\n\n\n\n<li>run the previous code (I2C scanner sketch). If you&#8217;re using Thonny IDE, you just need to click on the green run icon.<\/li>\n<\/ul>\n\n\n\n<p>The I2C address of your display will be printed on the shell. In my case, it&#8217;s the default 0x3c. <strong>Yours might be different<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"write-text\">Write Text &#8211; OLED Display<\/h2>\n\n\n\n<p>The Adafruit library for the OLED display comes with several functions to write text. In this section, you&#8217;ll learn how to write text using the library functions.<\/p>\n\n\n\n<p>The following sketch displays the <span class=\"rnthl rntliteral\">Hello, world!<\/span> message three times in the OLED display.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Complete project details at https:\/\/RandomNerdTutorials.com\/raspberry-pi-pico-ssd1306-oled-micropython\/\r\n\r\nfrom machine import Pin, SoftI2C\r\nimport ssd1306\r\n\r\n#You can choose any other combination of I2C pins\r\ni2c = SoftI2C(scl=Pin(5), sda=Pin(4))\r\n\r\noled_width = 128\r\noled_height = 64\r\noled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)\r\n\r\noled.text('Hello, World 1!', 0, 0)\r\noled.text('Hello, World 2!', 0, 10)\r\noled.text('Hello, World 3!', 0, 20)\r\n\r\noled.show()\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/Raspberry-Pi-Pico\/MicroPython\/main_SSD1306_.Oled_Basic.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>Let&#8217;s take a quick look at how the code works.<\/p>\n\n\n\n<p>Start by importing the necessary modules to interact with the GPIOs and send data to the OLED via I2C communication. You need to import the <span class=\"rnthl rntliteral\">Pin<\/span> and <span class=\"rnthl rntliteral\">SoftI2C<\/span> classes from the <span class=\"rnthl rntliteral\">machine<\/span> module.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>from machine import Pin, SoftI2C<\/code><\/pre>\n\n\n\n<p>You also need to import the OLED library that you previously uploaded to the board as <em>ssd1306.py<\/em> file.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>import ssd1306<\/code><\/pre>\n\n\n\n<p>We&#8217;ll use GPIO 4 (SDA) and GPIO 5 (SCL) to communicate with the display using I2C communication protocol, but you can use any other I2C pins.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>#You can choose any other combination of I2C pins\ni2c = SoftI2C(scl=Pin(5), sda=Pin(4))<\/code><\/pre>\n\n\n\n<p> Define the OLED width and height on the following variables:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled_width = 128\noled_height = 64<\/code><\/pre>\n\n\n\n<p>After that, create an <span class=\"rnthl rntliteral\">SSD1306_I2C<\/span> object called <span class=\"rnthl rntliteral\">oled<\/span>. This object accepts the OLED width, height, and the I2C pins you defined earlier.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group rntbox rntclgreen\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p>By default, the code assumes your OLED display has the default <strong>0x3c <\/strong>I2C address. If you have a different I2C address, change the previous line to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>oled = SSD1306_I2C(oled_width, oled_height, i2c, addr = <strong>YOUR_I2C_ADDRESS<\/strong>)<\/code><\/pre>\n\n\n\n<p>For example, if your I2C address is <strong>0x3d<\/strong>, it will look as follows (<a href=\"#i2c-scanner\" title=\"\">you can check your I2C address here<\/a>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>oled = SSD1306_I2C(oled_width, oled_height, i2c, addr = <strong>0x3d<\/strong>)<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<p>After initializing the OLED display, you just need to use the <span class=\"rnthl rntliteral\">text()<\/span> function on the <span class=\"rnthl rntliteral\">oled<\/span> object to write text. After the <span class=\"rnthl rntliteral\">text()<\/span> function, you need to call the <span class=\"rnthl rntliteral\">show()<\/span> method to update the OLED.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.text('Hello, World 1!', 0, 0)\noled.text('Hello, World 2!', 0, 10)\noled.text('Hello, World 3!', 0, 20)\noled.show()<\/code><\/pre>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">text()<\/span> method accepts the following arguments (in this order):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Message:<\/strong> must be of type String<\/li>\n\n\n\n<li><strong>X position:<\/strong> where the text starts<\/li>\n\n\n\n<li><strong>Y position:<\/strong> where the text is displayed vertically<\/li>\n\n\n\n<li><strong>Text color:<\/strong> it can be either black or white. The default color is white and this parameter is optional.\n<ul class=\"wp-block-list\">\n<li>0 = black<\/li>\n\n\n\n<li>1 = white<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>For example, the following line writes the \u2018Hello, World 1!\u2019 message in white color. The text starts on x = 0 and y = 0. <\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.text('Hello, World 1!', 0, 0)<\/code><\/pre>\n\n\n\n<p> The next line of code writes the text on the next line (y =10).<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.text('Hello, World 2!', 0, 10)<\/code><\/pre>\n\n\n\n<p>Finally, for the changes to take effect, use the <span class=\"rnthl rntliteral\">show()<\/span> method on the <span class=\"rnthl rntliteral\">oled<\/span> object.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.show()<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Demonstration<\/h2>\n\n\n\n<p>Save the code to your Raspberry Pi Pico board using <a href=\"https:\/\/randomnerdtutorials.com\/getting-started-raspberry-pi-pico-w\/#install-thonny-ide\">Thonny IDE<\/a> or any other MicroPython IDE of your choice.<\/p>\n\n\n\n<p>Copy the code provided to a new file on Thonny IDE.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"682\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/01\/oled-thonny-code.png?resize=651%2C682&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico OLED MicroPython code on Thonny IDE\" class=\"wp-image-145330\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/01\/oled-thonny-code.png?w=651&amp;quality=100&amp;strip=all&amp;ssl=1 651w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/01\/oled-thonny-code.png?resize=286%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 286w\" sizes=\"(max-width: 651px) 100vw, 651px\" \/><\/figure><\/div>\n\n\n<p>With the code copied to the file, click on the&nbsp;<strong>Save&nbsp;<\/strong>icon. Then, select&nbsp;<strong>Raspberry Pi Pico<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"214\" height=\"203\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Save-file-to-Raspberry-Pi-Pico.png?resize=214%2C203&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Saving file to Raspberry Pi Pico MicroPython IDE\" class=\"wp-image-130899\"\/><\/figure><\/div>\n\n\n<p>Save the file with the following name:&nbsp;<strong>main.py<\/strong>. Overwrite any existing files with the same name. Notice that you should also have the <em>ssd1306.py<\/em> file that you saved previously.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"545\" height=\"327\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/thonny-ide-main-py-ssd1306.jpg?resize=545%2C327&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"main.py thonny IDE with ssd1306 file\" class=\"wp-image-132910\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/thonny-ide-main-py-ssd1306.jpg?w=545&amp;quality=100&amp;strip=all&amp;ssl=1 545w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/thonny-ide-main-py-ssd1306.jpg?resize=300%2C180&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><\/figure><\/div>\n\n\n<p><strong>Note<\/strong>: When you name a file <span class=\"rnthl rntliteral\">main.py<\/span>, the Raspberry Pi Pico will run that file automatically on boot. If you call it a different name, it will still be saved on the board filesystem, but it will not run automatically on boot.<\/p>\n\n\n\n<p>Reset your board (unplug and plug it into your computer). Click the little green button &#8220;Run Current Script&#8221; or press F5.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"78\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/06\/thonny-ide-run-code.png?resize=450%2C78&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"run micropython script press play button\" class=\"wp-image-132505\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/06\/thonny-ide-run-code.png?w=450&amp;quality=100&amp;strip=all&amp;ssl=1 450w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/06\/thonny-ide-run-code.png?resize=300%2C52&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/figure><\/div>\n\n\n<p>The OLED should display the three &#8220;Hello World&#8221; messages that we&#8217;ve written on the code.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-MicroPython-Write-text-oled-display.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico Hello World OLED Display\" class=\"wp-image-132912\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-MicroPython-Write-text-oled-display.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-MicroPython-Write-text-oled-display.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p class=\"rntbox rntclgray\"><strong>Toubleshooting<\/strong>: if you get weird error messages and your OLED display doesn&#8217;t work, try to power it with 5V instead of 3V3. In that case, connect the VCC pin to the Raspberry Pi Pico VBUS pin.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"other-oled-functions\">Other OLED functions<\/h2>\n\n\n\n<p>The library provides other methods to interact with the OLED display.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Fill the screen<\/h3>\n\n\n\n<p>To fill the entire screen with white, use the <span class=\"rnthl rntliteral\">fill()<\/span> function as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.fill(1)\noled.show()<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-pi-pico-fill-white-oled-micropython.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"oled fill white screen raspberry pi pico micropython\" class=\"wp-image-132914\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-pi-pico-fill-white-oled-micropython.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-pi-pico-fill-white-oled-micropython.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>To clear the screen use the <span class=\"rnthl rntliteral\">fill()<\/span> method and pass <span class=\"rnthl rntliteral\">0<\/span> as argument. (Sets all pixels to black):<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.fill(0)\noled.show()<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Draw a pixel<\/h3>\n\n\n\n<p>To draw a pixel, use the <span class=\"rnthl rntliteral\">pixel()<\/span> method, followed by the <span class=\"rnthl rntliteral\">show()<\/span> method. The <span class=\"rnthl rntliteral\">pixel()<\/span> method accepts the following arguments:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>X coordinate:<\/strong> pixel location horizontally<\/li>\n\n\n\n<li><strong>Y coordinate:<\/strong> pixel location vertically<\/li>\n\n\n\n<li><strong>Pixel color:<\/strong> can be black or white\n<ul class=\"wp-block-list\">\n<li>0 = black<\/li>\n\n\n\n<li>1 = white<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>For example, to draw a white pixel on the top left corner:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.pixel(0, 0, 1)\noled.show()<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-draw-pixel-micropython.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"oled display a pixel raspberry pi pico micropython\" class=\"wp-image-132915\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-draw-pixel-micropython.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-draw-pixel-micropython.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Invert colors<\/h3>\n\n\n\n<p>You can also invert the OLED colors:  white with black and vice versa, using the <span class=\"rnthl rntliteral\">invert()<\/span> method:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.invert(True)<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-pi-pico-invert-oled-colors-micropython.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"oled invert colors raspberry pi pico micropython\" class=\"wp-image-132917\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-pi-pico-invert-oled-colors-micropython.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-pi-pico-invert-oled-colors-micropython.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>To get back to the original colors, use:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.invert(False)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Displaying data from sensors<\/h2>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">text()<\/span> function only accepts variables of type String as a message. Sensor readings are usually stored in int or float variables. <\/p>\n\n\n\n<p>If you want to display sensor readings and they are stored in int or float variables, they should be converted to a String. To convert the data to a string you can use the <span class=\"rnthl rntliteral\">str()<\/span> function:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>temperature = 12.34\ntemperature_string = str(temperature)<\/code><\/pre>\n\n\n\n<p>Then, you can display the <span class=\"rnthl rntliteral\">temperature_string<\/span> variable on the OLED using the <span class=\"rnthl rntliteral\">text()<\/span> and <span class=\"rnthl rntliteral\">show()<\/span> methods:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>oled.text(temperature_string, 0, 0)\noled.show()<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this guide, we&#8217;ve shown you how to display text in the OLED display with the Raspberry Pi Pico programmed with MicroPython firmware. We&#8217;ve also shown you other useful functions to control the OLED display.<\/p>\n\n\n\n<p>Learn more about the Raspberry Pi Pico with our exclusive eBook:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-micropython-ebook\/\" title=\"\"><strong>Learn Raspberry Pi Pico with MicroPython (eBook)<\/strong><\/a><\/li>\n<\/ul>\n\n\n\n<p>If you&#8217;re getting started with the Raspberry Pi Pico, you may also like reading some of the following tutorials:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-raspberry-pi-pico-w\/?preview=true&amp;_thumbnail_id=130915\">Getting Started with Raspberry Pi Pico (and Pico W)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-pinout-gpios\/\">Raspberry Pi Pico and Pico W Pinout Guide: GPIOs Explained<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-outputs-inputs-micropython\/\">Raspberry Pi Pico: Control Digital Outputs and Read Digital Inputs (MicroPython)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-analog-inputs-micropython\/\">Raspberry Pi Pico: Read Analog Inputs (MicroPython)<\/a><\/li>\n<\/ul>\n\n\n\n<p><a href=\"https:\/\/randomnerdtutorials.com\/projects-raspberry-pi-pico\/\">Check out all our Raspberry Pi Pico Guides \u00bb<\/a><\/p>\n\n\n\n<p>If you prefer to program the Raspberry Pi Pico using Arduino IDE, you can get started with the following tutorial:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/programming-raspberry-pi-pico-w-arduino-ide\/\">Programming Raspberry Pi Pico with Arduino IDE<\/a><\/li>\n<\/ul>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide shows how to use the SSD1306 OLED display with the Raspberry Pi Pico programmed with MicroPython firmware. You&#8217;ll learn how to display text and other useful functions to &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Raspberry Pi Pico: SSD1306 OLED Display (MicroPython)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-ssd1306-oled-micropython\/#more-132900\" aria-label=\"Read more about Raspberry Pi Pico: SSD1306 OLED Display (MicroPython)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":132903,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[324,326],"tags":[],"class_list":["post-132900","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-pico","category-raspberry-pi-pico-micropython"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/07\/Raspberry-Pi-Pico-OLED-MicroPython.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/132900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=132900"}],"version-history":[{"count":24,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/132900\/revisions"}],"predecessor-version":[{"id":154870,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/132900\/revisions\/154870"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/132903"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=132900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=132900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=132900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}