Printing int on oled

Im new to arduino and i want to print int r1 into oled screen but it dosent work, please help

Code below

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1331.h>
#include <SPI.h>

#define sclk 13
#define mosi 11
#define cs   10
#define rst  8
#define dc   7

#define	BLACK           0x0000
#define	BLUE            0x001F
#define	RED             0xF800
#define	GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0
#define WHITE           0xFFFF

int r1 = random(100);

Adafruit_SSD1331 display = Adafruit_SSD1331(&SPI, cs, dc, rst);

float p = 3.1415926;


void setup(void) {
   
  
    display.begin();
    display.fillScreen(BLACK);
  
    }

void loop() 
    {
   
    display.setCursor(0,0);
    display.print("test");
    display.setCursor(10,10);
    display.print(r1);
    display.setCursor(20,20);
    display.print("");
     
    
}

Welcome to the forum

Does the text print ?

0,0 is the left upper corner. Try to print in the midle of the screen.

Does the word "test" print ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.