Hi team i am using the underneath code for displaying text on 0.96inch SPI display. I have spend lots of hours in troubleshooting but all in vein . serial monitor says 15:32:35.340 -> Display initialized successfully
15:32:42.377 -> Displayed 'Hello' on the screen
but nothing is displayed on the oled display. Pins on my display module read gnd,vdd,sck,sda,res,dc,cs. I have used this pin configuration gnd->gnd, vdd->5v, sck->d13, sda->d11, res->d8,dc->d9,cs->d10. i am using arduino uno r4 wifi board.
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET 8
#define OLED_DC 9
#define OLED_CS 10
// Declaration for SSD1306 display connected using hardware SPI:
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
while (!Serial) {
; // Wait for serial port to connect. Needed for native USB
}
Serial.println(F("Starting setup..."));
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}
Serial.println(F("Display initialized successfully"));
// Clear the buffer
display.clearDisplay();
// Display "Hello"
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // Draw white text
display.setCursor(0, 0); // Start at top-left corner
display.println(F("Hello"));
// Show the display buffer on the screen
display.display();
Serial.println(F("Displayed 'Hello' on the screen"));
}
void loop() {
// Nothing to do here
}
I don't understand what SPI you are talking about. Your command to define and initialize the display is typical for I2C protocol. I also have several similar displays and they are all I2C, not SPI. Naming pins SDA and SCK is typical for I2C.
The OP used the terms SDA and SCL making me think !2C. It turns out looking at the Adafruit site mentioned above that this display is either SPI or I2C. I wonder if the OP has confused the pins/wires and code. I recommend clicking the Adafruit link above and reading for understanding the documentation there. Then try the sample, if that works then wire up your(OP) project.
p.s. I don't know how to tag people, it would be useful here.
In the reply window type ”@“. It will bring up a list of participants in the topic. If the person you want to tag doesn’t appear on the list, just type the first letter or two of their user name. They will show and you can select their name.
Sorry for the sidetrack. If you do the “How to use the website exercise you will learn this and much more”
I thought there must be an easier way then either remembering a handle, or pawing back thru the thread. Thanks.
I will have a look at the resource you mentioned, but for someone with ASD I will probably zone out in less than a couple minutes.
Do you mean you tried your code with the changes suggested by @Brazilino , or do you mean you tried the example sketch in the link given by @Brazilino ?
If you did not try the example sketch from the link, that is the most important thing to try now.
I have tried with the example sketch .. and with o two displays separately... i hope i am not that unlucky to have both the displays faulty ..i hope this library works with arduino r4 wifi.