Forum: Mikrocontroller und Digitale Elektronik mini oled geht nicht zu programmieren


von Jens H. (shadowbird)


Lesenswert?

Hallo habe mir für mein Nano v3 ein kleinen OLed besorgt und habe mir 
die Library von Sparkfun geladen wo die beispiele funktionieren, die von 
Adafruid gehen bei mir nicht. Nun wollte ich das OLed selbst 
programmieren was nicht funktioniert oder ich bin dazu zu doof. Kann mir 
da mal jemand unter die Arme greifen? habe es über SPI angeschlossen und 
auch schon einiges probiert aber kein Sketch will laufen. Was mache ich 
falsch?

von egbert (Gast)


Lesenswert?

Jens H. schrieb:
> Was mache ich falsch?

Das ist aufgrund der Informationslage nicht zu beurteilen.

Typenbezeichnung(en), Schalt-/Verdrahtungsplan, ...

von Jens H. (shadowbird)


Lesenswert?

Typ: 0,96 Zoll SPI-128X64 OLED LCD-LED-Display-Modul für Arduino UNO
Verdrahtung: 
https://learn.sparkfun.com/tutorials/micro-oled-breakout-hookup-guide
den beispielcode ganz unten auf dieser Seite habe ich ausprobiert geht 
nicht daa kommt immer eine Fehlermelung.

von Wegstaben V. (wegstabenverbuchsler)


Lesenswert?

Ist die Fehlermeldung geheim?

von Jens H. (shadowbird)


Lesenswert?

nein wenn ich den Sketch überprüfenlasse kommt immer an einigen stellen 
die Meldung" was not declared in this scope" .

von Bogdan (Gast)


Lesenswert?

Wurm für Wurm, Würmchen für Würmchen, bis der Humus kommt.

von Jens H. (shadowbird)


Lesenswert?

Was soll das heißen?

von M. V. (-_-)


Lesenswert?

Er meint, du sollst dir nicht alles aus der Nase ziehen lassen. Poste 
den Quelltext, den Schaltplan und die Fehlermeldungen (vollständig!) - 
dann kann man dir auch helfen.

Ohne bleibt es bei einem (höchst qualifizierten) "meine Kristallkugel 
hat über die Feiertage auch Urlaub".

: Bearbeitet durch User
von Jens H. (shadowbird)


Lesenswert?

#include <SPI.h>
#include <Wire.h>
#include <SFE_MicroOLED.h>
#define PIN_RESET 9  // Connect RST to pin 9 (req. for SPI and I2C)
#define PIN_DC    8  // Connect DC to pin 8 (required for SPI)
#define PIN_CS    10 // Connect CS to pin 10 (required for SPI)
//#define DC_JUMPER 0 // (I2C only) Set to either 0 or 1, matching the 
value of the DC Jumper

// Declare a MicroOLED object. The parameters include:
// 1 - Reset pin: Any digital pin
// 2 - D/C pin: Any digital pin (SPI mode only)
// 3 - CS pin: Any digital pin (SPI mode only, 10 recommended)
MicroOLED oled(PIN_RESET, PIN_DC, PIN_CS); // Example SPI Declaration
//MicroOLED oled(PIN_RESET, DC_JUMPER); // Example I2C Declaration
void setup()
{
    // Before you can start using the OLED, call begin() to init
    // all of the pins and configure the OLED.
    MicroOLED.begin();
}
// Draw a pixel in the middle of the screen
MicroOLED.pixel(LCDWIDTH/2, LCDHEIGHT/2); // Add a pixel to the display 
buffer.
MicroOLED.display(); // Draw whatever is in the display buffer.
int x0 = 7; int y0 = 7;   // (x0,y0) = (7, 7)
int x1 = 42; int y1 = 24; // (x1,y1) = (42, 24)
MicroOLED.line(x0, y0, x1, y1);  // Draw a line from (x0,y0) to (x1,y1);
MicroOLED.display(); // Draw to the screen
int x0 = 7; int y0 = 5;
int width = 24;
int height = 13;
MicroOLED.rect(x0, y0, width, height);  // Draw a rectange from (7,5) to 
(31,18)
MicroOLED.display(); // Draw to the screen
MicroOLED.rectFill(7, 5, 35, 5); // Fill a rectangle from (7, 5) to (42, 
10)
MicroOLED.display(); // Draw to the screen
int radius = 13;
// Draw a 13-pixel radius (26-pixel diameter)
// circle centered in the middle of the display:
MicroOLED.circle(LCDWIDTH/2, LCDHEIGHT/2, radius);
MicroOLED.circleFill(42, 20, 7); // Fill a circle, 7 radius, centered at 
(42, 20)
MicroOLED.display(); // Draw to the screen
MicroOLED.setFontType(0);  // Set the text to small (10 columns, 6 rows 
worth of characters).
MicroOLED.setFontType(1);  // Set the text to medium (6 columns, 3 rows 
worth of characters).
MicroOLED.setFontType(2);  // Set the text to medium/7-segment (5 
columns, 3 rows worth of characters).
MicroOLED.setFontType(3);  // Set the text to large (5 columns, 1 row 
worth of characters).
  // Set the text cursor to the upper-left of the screen.
// Set the text cursor to the upper-left of the screen.

 // Draw to the screen
 // put your setup code here, to run once:

}

void loop()
{
  MicroOLED.print("Hello, world"); // Print a const string
MicroOLED.print(analogRead(0));  // Print an integer
MicroOLED.print(42.07);  // Print a float
MicroOLED.display(); // Draw to the screen


}

von Carl D. (jcw2)


Lesenswert?

void setup()
{
    // Before you can start using the OLED, call begin() to init
    // all of the pins and configure the OLED.
    MicroOLED.begin();
}
endet hier. Alles danach bis loop() ist außerhalb einer Funktion.

Die } nach .begin(); muß weg!

: Bearbeitet durch User
von Jens H. (shadowbird)


Lesenswert?

habe sie weggemacht und neu überprüfen lassen. da kommt dann wieder 
einen Fehlermeldung und zwar bei void loop "MicroOLED.display();" fehler 
expected unqualified-id before `.`token.

von Carl D. (jcw2)


Lesenswert?

Meine erste Anmerkung war nur wegen formal falschem Code.
Wenn ich jetzt noch mal drüber schaue, fällt mir auf daß am Anfang ein 
Objekt "oled" definiert wird. Ich würde erwarten, daß dieses dann auch 
benutzt wird:
1
// Declare a MicroOLED object. The parameters include:
2
// 1 - Reset pin: Any digital pin
3
// 2 - D/C pin: Any digital pin (SPI mode only)
4
// 3 - CS pin: Any digital pin (SPI mode only, 10 recommended)
5
MicroOLED oled(PIN_RESET, PIN_DC, PIN_CS); // Example SPI Declaration
6
//MicroOLED oled(PIN_RESET, DC_JUMPER); // Example I2C Declaration
7
8
void setup()
9
{
10
  // Before you can start using the OLED, call begin() to init
11
  // all of the pins and configure the OLED.
12
  oled.begin();
13
14
  // Draw a pixel in the middle of the screen
15
  oled.pixel(LCDWIDTH/2, LCDHEIGHT/2); // Add pixel to display buffer.
16
  oled.display(); // Draw whatever is in the display buffer
17
}
18
...

von T.M .. (max)


Lesenswert?

nimm ne andere lib. die u8lib funktioniert

von Jens H. (shadowbird)


Lesenswert?

leider nicht habe sie probiert

von Carl D. (jcw2)


Lesenswert?

Noch hatte die Lib keine Chance etwas zu tun. Erst sind mal 
C(++)-Grundlagen dran ;-)

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.