Administrator  Super Admin Beiträge:8 |
Gleisanzeige |
|
|
//Modelleisenbahn Service
//www.modelleisenbahn-service.de
//Gleisanzeige
//Copy 2025 Heinz Cremer
// Small Simple OLED library demo for AVR platform,
// without line drawing function (saving of 1K RAM)
//
#include <ss_oled.h>
SSOLED ssoled;
#define SDA_PIN -SDA
#define SCL_PIN -SCL
// no reset pin needed
#define RESET_PIN -1
// let ss_oled find the address of our display
#define OLED_ADDR -1
#define FLIP180 0
#define INVERT 0
// Use the default Wire library
#define USE_HW_I2C 1
void setup()
{
int rc;
rc = oledInit(&ssoled, OLED_64x32, OLED_ADDR, FLIP180, INVERT, USE_HW_I2C, SDA_PIN, SCL_PIN, RESET_PIN, 400000L); // Standard HW I2C bus at 400Khz
if (rc != OLED_NOT_FOUND)
{
char *msgs[] =
{
(char *)"SSD1306 @ 0x3C",
(char *)"SSD1306 @ 0x3D",
(char *)"SH1106 @ 0x3C",
(char *)"SH1106 @ 0x3D"
};
oledFill(&ssoled, 0, 1);
oledWriteString(&ssoled, 0, 0, 1, (char *)"Heinz:", FONT_NORMAL, 0, 1);
oledWriteString(&ssoled, 0, 8, 2, msgs[rc], FONT_NORMAL, 0, 1);
delay(0);
}
}
void loop()
{
int i, x, y;
oledFill(&ssoled, 0, 1);
oledWriteString(&ssoled, 0, 5, 0,(char *)"Wuppertal", FONT_SMALL, 0, 1);
oledWriteString(&ssoled, 0, 16, 1,(char *)"nach", FONT_SMALL, 0, 1);
oledWriteString(&ssoled, 0, 5, 2,(char *)"Bonn Hbf", FONT_SMALL, 0, 1);
oledWriteString(&ssoled, 0, 5, 3,(char *)"Gleis 1", FONT_SMALL, 0, 1);
delay(1000000);
oledFill(&ssoled, 0, 1);
for (i = 0; i < 1000; i++)
{
x = random(64);
y = random(32);
oledSetPixel(&ssoled, x, y, 1, 1);
}
delay(2000);
}
|
|