TeensyNoob42
New member
Hello TeensyNoob here,
I can't get my Waveshare 1.5" working with my Teensy 4.1.
What I tried so far:
1) Connecting it via SPI (SPI0):
By connecting it as follow:
VCC to 3.3
GND to GND
DIN to PIN 11 (MOSI)
CLK to PIN 13 (SCK)
CS to PIN 10 (CS)
DC to PIN 8
RST to PIN 9
Down below is my code, for SPI1 I just changed the input pins.
2) Connecting it via SPI1
VCC to 3.3
GND to GND
DIN to PIN 26 (MOSI)
CLK to PIN 27 (SCK)
CS to PIN 38 (CS)
DC to PIN 8
RST to PIN 9
Each time I just get a black screen, connecting it to a Arduino Uno worked without a problem. I'm using a PlattformIO and imported the Libraries with PlattformIO.
Do someone know what I'm doing wrong? My guess is that something with the SPI protocol is wrong. I would be glad if someone could help me. Thanks in advance!
When I run the code, it prints "Display Startup...!" and "Display Ready!", so no error there.
My code:
Display.h:
Display.cpp:
main.cpp:
I can't get my Waveshare 1.5" working with my Teensy 4.1.
What I tried so far:
1) Connecting it via SPI (SPI0):
By connecting it as follow:
VCC to 3.3
GND to GND
DIN to PIN 11 (MOSI)
CLK to PIN 13 (SCK)
CS to PIN 10 (CS)
DC to PIN 8
RST to PIN 9
Down below is my code, for SPI1 I just changed the input pins.
2) Connecting it via SPI1
VCC to 3.3
GND to GND
DIN to PIN 26 (MOSI)
CLK to PIN 27 (SCK)
CS to PIN 38 (CS)
DC to PIN 8
RST to PIN 9
Each time I just get a black screen, connecting it to a Arduino Uno worked without a problem. I'm using a PlattformIO and imported the Libraries with PlattformIO.
Do someone know what I'm doing wrong? My guess is that something with the SPI protocol is wrong. I would be glad if someone could help me. Thanks in advance!
When I run the code, it prints "Display Startup...!" and "Display Ready!", so no error there.
My code:
Display.h:
Code:
#ifndef DISPLAY_H
#define DISPLAY_H
#include <Arduino.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1351.h>
extern Adafruit_SSD1351 OLED;
class Display {
public:
Display();
void Startup();
};
#endif
Display.cpp:
Code:
#include <Display.h>
// Screen dimension
const byte SCREEN_WIDTH = 128;
const byte SCREEN_HEIGHT = 128;
// Pins
const byte CS_PIN = 10; // for CS1: 38
const byte DC_PIN = 8;
const byte RST_PIN = 9;
const byte DIN_PIN = 11; // for MOSI1: 26
const byte CLK_PIN = 13; // for SCK1: 27
// Color
const uint16_t WHITE = 0xFFFF;
// Display
Adafruit_SSD1351 OLED = Adafruit_SSD1351(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI, CS_PIN, DC_PIN, RST_PIN); // for SPI0
//Adafruit_SSD1351 OLED = Adafruit_SSD1351(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI1, CS_PIN, DC_PIN, RST_PIN); // for SPI1
Display::Display()
{
//OLED.begin();
}
void Display::Startup()
{
Serial.println("Display Startup...!");
OLED.begin();
OLED.fillScreen(WHITE);
Serial.println("Display Ready!");
}
main.cpp:
Code:
#include <SPI.h>
#include <Arduino.h>
#include <Display.h>
Display display;
void setup() {
Serial.begin(9600);
display.Startup();
Serial.println("Ready!");
}
void loop() {
}