single repo

This commit is contained in:
Adolfo Reyna
2026-01-01 13:33:51 -05:00
parent 8b56187ef1
commit bc8ae91eba
334 changed files with 124529 additions and 2 deletions
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.13)
include(pico_sdk_import.cmake)
project(multiple_displays)
pico_sdk_init()
add_subdirectory(pico-ssd1306)
add_executable(multiple_displays
main.cpp)
target_link_libraries(multiple_displays
hardware_i2c
pico_ssd1306)
pico_add_extra_outputs(multiple_displays)
@@ -0,0 +1,44 @@
#include "pico/stdlib.h"
#include "pico-ssd1306/ssd1306.h"
#include "pico-ssd1306/textRenderer/TextRenderer.h"
#include "hardware/i2c.h"
// Use the namespace for convenience
using namespace pico_ssd1306;
int main() {
// Init i2c0 controller
i2c_init(i2c0, 1000000);
// Set up pins 12 and 13
gpio_set_function(12, GPIO_FUNC_I2C);
gpio_set_function(13, GPIO_FUNC_I2C);
gpio_pull_up(12);
gpio_pull_up(13);
// If you don't do anything before initializing a display pi pico is too fast and starts sending
// commands before the screen controller had time to set itself up, so we add an artificial delay for
// ssd1306 to set itself up
sleep_ms(250);
// Create a new display object at address 0x3C and size of 128x32
SSD1306 display1 = SSD1306(i2c0, 0x3C, Size::W128xH32);
// Create a new display object at address 0x3D and size of 128x64
SSD1306 display2 = SSD1306(i2c0, 0x3D, Size::W128xH64);
// Here we rotate the display by 180 degrees, so that it's not upside down from my perspective
// If your screen is upside down try setting it to 1 or 0
display1.setOrientation(0);
display2.setOrientation(0);
// Draw text on display 1
drawText(&display1, font_16x32, "Disp 1", 0, 0);
// Draw text on display 2
drawText(&display2, font_16x32, "Disp 2", 0, 0);
// Send buffer to the displays
display1.sendBuffer();
display2.sendBuffer();
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 363 KiB

@@ -0,0 +1,3 @@
# This examples produces such a result
![output](output1.jpg)