Hallo,
ich bin neu hier.
Kurz zu mir, ich bin Michael, 27 und komme aus Österreich.
Mein Problem:
Ich habe es bereits mit allen möglichen Librarys probiert - ohne Erfolg.
Wie am Bild zu sehen erscheint zwar die Ausgabe aber man sieht nur einen winzigen Teil davon ganz unten am Display.
Ebenso wechselt die Anzeige was ja auch so gewollt ist.
Der obere weiß/schwarze gepunktete Bereicht ist aber eher unvorteilhaft.
Nutze diese Library GitHub - rene-mt/esp8266-oled-sh1106: Driver for the SH1106 based 128x64 pixel OLED display running on the Arduino/ESP8266 platform
Mein aktueller Code (war das Beispiel aus der Library da aber der Anzeigefehler von Anfang an da war beim Beispiel habe ich den Sketch eben nach und nach minimalisiert - Ergebnis leider das selbe.
Mein Code:
/**The MIT License (MIT)
Copyright (c) 2016 by Rene-Martin Tudyka
Based on the SSD1306 OLED library Copyright (c) 2015 by Daniel Eichhorn (http://blog.squix.ch),
available at https://github.com/squix78/esp8266-oled-ssd1306
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
See more at http://blog.squix.ch
*/
#include <Wire.h>
#include <SPI.h>
#include "SH1106.h"
#include "SH1106Ui.h"
#include "images.h"
// Pin definitions for I2C
#define OLED_SDA D1 // pin 14
#define OLED_SDC D2 // pin 12
#define OLED_ADDR 0x3C
/* Hardware Wemos D1 mini SPI pins
D5 GPIO14 CLK - D0 pin OLED display
D6 GPIO12 MISO (DIN) - not connected
D7 GPIO13 MOSI (DOUT) - D1 pin OLED display
D1 GPIO5 RST - RST pin OLED display
D2 GPIO4 DC - DC pin OLED
D8 GPIO15 CS / SS - CS pin OLED display
*/
// Pin definitions for SPI
// ESP8266
//#define OLED_RESET 5 // RESET
//#define OLED_DC 4 // Data/Command
//#define OLED_CS 15 // Chip select
// Node MCU
//#define OLED_RESET D1 // RESET
//#define OLED_DC D2 // Data/Command
//#define OLED_CS D8 // Chip select
// Uncomment one of the following based on OLED type
//SH1106 display(true, OLED_RESET, OLED_DC, OLED_CS); // FOR SPI
SH1106 display(OLED_ADDR, OLED_SDA, OLED_SDC); // For I2C
SH1106Ui ui ( &display );
bool msOverlay(SH1106 *display, SH1106UiState* state) {
display->setTextAlignment(TEXT_ALIGN_RIGHT);
display->setFont(ArialMT_Plain_10);
display->drawString(128, 64, String(millis()));
return true;
}
bool drawFrame1(SH1106 *display, SH1106UiState* state, int x, int y) {
// draw an xbm image.
// Please note that everything that should be transitioned
// needs to be drawn relative to x and y
// if this frame need to be refreshed at the targetFPS you need to
// return true
display->drawString(0, 20, "Arial 16");
display->drawString(0, 40, "Arial 16");
display->drawString(128, 64, "Arial 16");
display->drawString(x, y, "Arial 16");
return false;
}
// how many frames are there?
int frameCount = 1;
// this array keeps function pointers to all frames
// frames are the single views that slide from right to left
bool (*frames[])(SH1106 *display, SH1106UiState* state, int x, int y) = { drawFrame1};
//bool (*overlays[])(SH1106 *display, SH1106UiState* state) = { msOverlay };
int overlaysCount = 1;
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println();
ui.setTargetFPS(30);
ui.setActiveSymbole(activeSymbole);
ui.setInactiveSymbole(inactiveSymbole);
// You can change this to
// TOP, LEFT, BOTTOM, RIGHT
ui.setIndicatorPosition(BOTTOM);
// Defines where the first frame is located in the bar.
ui.setIndicatorDirection(LEFT_RIGHT);
// You can change the transition that is used
// SLIDE_LEFT, SLIDE_RIGHT, SLIDE_TOP, SLIDE_DOWN
ui.setFrameAnimation(SLIDE_LEFT);
// Add frames
ui.setFrames(frames, frameCount);
// Add overlays
// ui.setOverlays(overlays, overlaysCount);
// Inital UI takes care of initalising the display too.
ui.init();
display.flipScreenVertically();
}
void loop() {
int remainingTimeBudget = ui.update();
if (remainingTimeBudget > 0) {
// You can do some work here
// Don't do stuff if you are below your
// time budget.
delay(remainingTimeBudget);
}
}
Damit erhalte ich die Ausgabe am Bild.
Hat jemand eine Idee ?
Hab schon viel gelesen auch wegen U8g2lib etc. aber umso mehr ich lese umso komplizierter wird es.
Was ich auch gestern getestet habe ist das hier:
#include <OLED.h>
// Example sketch for testing OLED display
// We need to include Wire.h for I2C communication
#include <Wire.h>
#include "OLED.h"
// Declare OLED display
// display(SDA, SCL);
// SDA and SCL are the GPIO pins of ESP8266 that are connected to respective pins of display.
OLED display(1, 2);
void setup() {
Serial.begin(9600);
Serial.println("OLED test!");
// Initialize display
display.begin();
// Test message
display.print("Hello World");
delay(3*1000);
// Test long message
display.print("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
delay(3*1000);
// Test display clear
display.clear();
delay(3*1000);
// Test message postioning
display.print("TOP-LEFT");
display.print("4th row", 4);
display.print("RIGHT-BOTTOM", 7, 4);
delay(3*1000);
// Test display OFF
display.off();
display.print("3rd row", 3, 8);
delay(3*1000);
// Test display ON
display.on();
delay(3*1000);
}
int r = 0, c = 0;
void loop() {
r = r % 8;
c = micros() % 6;
if (r == 0)
display.clear();
display.print("Hello World", r++, c++);
delay(500);
}
Das hat gestern tatsächlich super geklappt , heute aber zeigt das Display nichts mehr an aber der ESP blinkt wie wird und ich erhalte einen wdt reset 4 (3,6).
Habe am Code seit gestern nichts verändert ....
Habe natürlich schon alles am ESP gelöscht - auch keine Änderung.
Ich wäre sehr dankbar wenn mir da jemand behilflich sein könnte.
Es muss nichts wildes sein um Grunde, ich will nur Texte ausgeben - mehr nicht.
Beste Grüße aus Österreich,
Michael