# Trying to run dual independent displays on a Pi PICO

**URL:** <https://forums.pimoroni.com/t/trying-to-run-dual-independent-displays-on-a-pi-pico/18833>\
**Category:** Support\
**Created:** [February 8, 2022, 7:53pm UTC](https://forums.pimoroni.com/t/trying-to-run-dual-independent-displays-on-a-pi-pico/18833 "2022-02-08T19:53:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [February 8, 2022, 7:53pm UTC](https://forums.pimoroni.com/t/trying-to-run-dual-independent-displays-on-a-pi-pico/18833/1 "2022-02-08T19:53:04Z")

</div>

I have the following  
Pi Pico  
Pico Breakout Garden Base:  
1.3" SPI Color Square LCD (240x240) Breakout: Rear SPI slot  
1.54" SPI Color Square LCD (240x240) Breakout: Front SPI slot

Each display is using a different chip select and backlight pin but they are mirroring each other. I “think” the issue is the display buffer line.  
`display_buffer = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)`  
If I do this  
`display_buffer1 = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)`  
`display_buffer2 = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)`  
I get MemoryError: memory allocation failed, allocating 115200 bytes for the second line.

```auto
import time
import machine
import gc

from breakout_colourlcd240x240 import BreakoutColourLCD240x240

width = BreakoutColourLCD240x240.WIDTH
height = BreakoutColourLCD240x240.HEIGHT

display_buffer = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)
display2 = BreakoutColourLCD240x240(display_buffer, cs=(22), bl=(21))
display2.set_backlight(0.8)
display1 = BreakoutColourLCD240x240(display_buffer, cs=(17), bl=(20))
display1.set_backlight(0.8)

while True:

    display1.set_pen(255, 255, 255)
    display1.text(rtc.string_date(), 40, 145, 240, 3)
    display1.text(rtc.string_time(), 60, 165, 240, 3)

    display1.update()
    display2.update()
    time.sleep(1)
    display1.set_pen(0, 0, 0)
    display1.clear()
    display2.set_pen(0, 0, 0)
    display2.clear()

```

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [February 8, 2022, 8:40pm UTC](https://forums.pimoroni.com/t/trying-to-run-dual-independent-displays-on-a-pi-pico/18833/2 "2022-02-08T20:40:07Z")

</div>

The solution I found is to  
draw to display 1,  
update it  
clear it (this clears out the display buffer)  
Now draw to display 2  
update it  
clear it (this empties out the display buffer)  
wash rinse and repeat.

```auto
    # time to update the display
    display1.update()
    display1.set_pen(0, 0, 0)
    display1.clear()
    
   # drawing the date and time
   
    display2.set_pen(255, 255, 255)
    display2.text(rtc.string_date(), 40, 145, 240, 3)
    display2.text(rtc.string_time(), 60, 165, 240, 3)
    
    display2.update()
    display2.set_pen(0, 0, 0)
    display2.clear()

    time.sleep(1)

```
