using_pico_with_ssd1306_based_lcd_and_spi
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| using_pico_with_ssd1306_based_lcd_and_spi [2026/08/21 14:49] – [Python Code] walkeradmin | using_pico_with_ssd1306_based_lcd_and_spi [2026/08/24 20:01] (current) – [Python Code] walkeradmin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Using Pico with SSD1306 based LCD and SPI ====== | ====== Using Pico with SSD1306 based LCD and SPI ====== | ||
| - | <color # | ||
| - | \\ | ||
| <color # | <color # | ||
| \\ | \\ | ||
| Line 52: | Line 50: | ||
| So SPI is faster, but there is no addressing, so you cannot chain multiple SPI devices from a single set of Pico GPIO Pins. If you need to run multiple displays, your choice is to either use I2C LCDs, or use multiple sets of SPI pins for each LCD. | So SPI is faster, but there is no addressing, so you cannot chain multiple SPI devices from a single set of Pico GPIO Pins. If you need to run multiple displays, your choice is to either use I2C LCDs, or use multiple sets of SPI pins for each LCD. | ||
| \\ | \\ | ||
| + | \\ | ||
| + | ---- | ||
| + | ==== The Driver for SPI (1306 driver chip) ==== | ||
| + | \\ | ||
| + | Below is the driver you will need for the LCD. You need to put it in to the <color # | ||
| + | |||
| + | < | ||
| + | from machine import Pin, SPI | ||
| + | from ssd1306_spi import SSD1306_SPI | ||
| + | import time | ||
| + | |||
| + | # SPI1 setup | ||
| + | spi = SPI(1, baudrate=8000000, | ||
| + | |||
| + | dc = Pin(13, Pin.OUT) | ||
| + | res = Pin(12, Pin.OUT) | ||
| + | cs = Pin(14, Pin.OUT) | ||
| + | |||
| + | oled = SSD1306_SPI(128, | ||
| + | |||
| + | oled.fill(0) | ||
| + | oled.text(" | ||
| + | oled.text(" | ||
| + | oled.text(" | ||
| + | oled.show() | ||
| + | |||
| + | # call the function below from your main code with the value 255 (max brightness) | ||
| + | oled.set_brightness(255) | ||
| + | </ | ||
| + | \\ | ||
| + | \\ | ||
| + | ---- | ||
| + | ==== LCD Test Code ---- | ||
| \\ | \\ | ||
| I want to look at the old I2C code and compare to the SPI code to point out some differences, | I want to look at the old I2C code and compare to the SPI code to point out some differences, | ||
| Line 133: | Line 164: | ||
| {{ : | {{ : | ||
| \\ | \\ | ||
| + | They both work really well and for simple text based applications will be perfect. | ||
| + | \\ | ||
| + | \\ | ||
| + | ---- | ||
using_pico_with_ssd1306_based_lcd_and_spi.1787323769.txt.gz · Last modified: by walkeradmin
