1

I am trying to set the text to scroll vertically. I have a big chunk of text (example in the code below) to be set to scroll vertically. What I want is to display the complete text on the screen. Presently it scrolls the complete chunk of text. any help or guidance is heartly welcome

#include <SPI.h>
#include <Wire.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

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// The pins for I2C are defined by the Wire-library. 
// On an arduino UNO:       A4(SDA), A5(SCL)
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
// On an arduino LEONARDO:   2(SDA),  3(SCL), ...
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3D ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
  display.clearDisplay();

  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Sometimes we dont want to scroll entire display. ");
  display.startscrollright(0x00, 0x0F);

  
  
  display.display();

  delay(1000);
}
void loop(){

}

The link to the project is here: https://wokwi.com/arduino/projects/302023407584674313

Edit 3rd

My question:

My goal is to display the text in the window. the text should not go out of the window. If the text is too much, it should vertically scroll.

Thanks again, everyone.

Ram Kumar
  • 31
  • 4
  • 3
    I'm not 100% sure what you're asking; your text mentions vertical scrolling, your code does horizontal scrolling of 16 rows, and your text presumably is much wider than the screen. Can you edit the question to be more clear? – Dave Newton Jun 21 '21 at 16:00
  • So you don't want to scroll, you want to wrap the text? – Dave Newton Jun 22 '21 at 14:54
  • So... you've abandoned the question about scrolling and instead want to just render some text as large as possible on the screen? – timemage Jun 22 '21 at 23:59
  • @DaveNewton timemage The whole text should be fit in the screen., It need not become large., It has to be scrollable, when the test is more than what the device can display – Ram Kumar Jun 23 '21 at 17:56
  • The whole text can't fit on the screen--are you saying if the text is larger than the screen it should automatically scroll? – Dave Newton Jun 23 '21 at 18:00
  • Dear @DaveNewton yes. exactly – Ram Kumar Jun 23 '21 at 18:02
  • And what is the current issue? You may also want to update your question to reflect the information from these comments, because the question asks about vertical scrolling. – Dave Newton Jun 23 '21 at 18:09
  • 1
    okay. I will update the question clearly soon – Ram Kumar Jun 23 '21 at 18:11

0 Answers0