Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mgoblin/arduinosplashscreen
Splashscreen arduino library
https://github.com/mgoblin/arduinosplashscreen
Last synced: about 1 month ago
JSON representation
Splashscreen arduino library
- Host: GitHub
- URL: https://github.com/mgoblin/arduinosplashscreen
- Owner: mgoblin
- License: mit
- Created: 2024-07-14T05:33:07.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-21T11:44:20.000Z (5 months ago)
- Last Synced: 2024-07-21T12:47:54.557Z (5 months ago)
- Language: C++
- Size: 198 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Splash screen library
## What is splash screen?
Splash screen is sequentialy displayed on program start screens.Splash screen enhances user experience in the following cases:
* Program needs long initialization
* Program should display usage tips## Why you need Strings splash screen library
Splash screen library sequencially change screens in non blocking manner.Each screen is described as a display interval and data.
The responsibility for implementing screen clearing and rendering is delegated to the code by the user of the library. This approach allows you to separate the logic of changing screens from the logic of drawing screens on different devices.
## Mininal example
### Step 1. Add library to your project
Use library manager.### Step 2. Describe screens
Example 1. Describe two LCD1602 screens
```cpp
#include
#include#define SPLASH_SCREENS_COUNT 2
mg::LCD1602Page page1 = mg::LCD1602Page { "LCD1111", "Test" };
mg::Screen screen1 = mg::Screen
{
.page = &page1,
.displayIntervalMs = 3000
};
mg::LCD1602Page page2 = mg::LCD1602Page { "Page2_1", "Page2_2" };
mg::Screen screen2 = mg::Screen
{
.page = &page2,
.displayIntervalMs = 5000
};mg::Screen screensArray[SPLASH_SCREENS_COUNT] = { screen1, screen2 };
```### Step 3. Define clear and render screen handlers
```cpp
#include// 0X3C+SA0 - 0x3C or 0x3D
#define OLED_I2C_ADDRESS 0x3CSSD1306AsciiWire oled;
void clearScreen()
{
oled.clear();
}void displayScreen(mg::LCD1602Page *page)
{
oled.println(page->line1);
oled.println(page->line2);
}
```### Step4. Use SplashScreen for sequentialy rendering screens
```cpp
mg::SplashScreen splashScreen(
screensArray, SPLASH_SCREENS_COUNT, clearScreen, displayScreen);void setup()
{
Wire.setClock(400000L);
oled.begin(&Adafruit128x64, OLED_I2C_ADDRESS);
oled.setFont(System5x7);splashScreen.display();
}void loop()
{
splashScreen.tick();
}
```