I am trying to run a monochrome OLED 128x64 screen from adafruit on a teensy4.1. While this is part of a larger project, I am having trouble running even the simple example code as part of the u8g2lib package "hello world". I do not consider myself an expert, but I do think I have it set up properly (with libraries). I have the data and clk connected to pins 19 and 18 respectively. The screen is powered by a 5 volt signal from the teensy and also connected via ground. I am running the code below but am not getting anything on the screen. Hoping someone might have a hint on how to sort this out. Thanks in advance!
Code:
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
/*
U8g2lib Example Overview:
Frame Buffer Examples: clearBuffer/sendBuffer. Fast, but may not work with all Arduino boards because of RAM consumption
Page Buffer Examples: firstPage/nextPage. Less RAM usage, should work with all Arduino boards.
U8x8 Text Only Example: No RAM usage, direct communication with display controller. No graphics, 8x8 Text only.
*/
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 18, /* data=*/ 19, /* reset=*/ U8X8_PIN_NONE); // ESP32 Thing, pure SW emulated I2C
void setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.clearBuffer(); // clear the internal memory
u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
u8g2.drawStr(0,10,"Hello World!"); // write something to the internal memory
u8g2.sendBuffer(); // transfer internal memory to the display
delay(1000);
}