HOW TO SCROLL THIS SIMPLE ARDUINO 8 X 8 dot matrix display chained 2 shift register code?

#define DATA 2
#define SHIFT 3
#define LATCH 4

int smile[] = {B00000000, B00100100, B00100100, B00100100,B00000000, B01000010, B00111100, B00000000}; //column 
void setup() {
  pinMode(DATA, OUTPUT);
  pinMode(SHIFT, OUTPUT);
  pinMode(LATCH, OUTPUT);

}

void loop() {
  for(int i = 0; i<8; i++){
    shiftOut(DATA, SHIFT, LSBFIRST, smile[i]);  //column shiftout first
    shiftOut(DATA, SHIFT, LSBFIRST, 128 >> i);   //then row 
    //before latching, the shift out would look like thissss.
   // from  this (R1, R2, R3, R4, ...... R8)
   // to this (C1, C2, C3, C4....C8, R1, R2, R3, R4........R8)
   // then finally calling latch();

    latch(); 

//THIS CODE PRODUCES A SMILE CHARACTER IN THE 8BY8 DOT MATRIX USING CHAINED SHIIFT REGISTERS WHICH MEANS THAT AT MY FUTURE MODIFICATON . 
//IF MAKE 1 BY 16 DISPLAY IT WILL STILL REQUIRE 3 PINS FOR BECAUSE I WANT TO MASTER MULTIPLEXING HAHAHA.
// I'M A COMPLETE NOOB AND I MADE THAT SIMPLE CODE AND I ALWAYS HOLD MYSELF FROM COPYING CODES FROM THE FORUMS AND YOUTUBE SO MAYBE YOU CAN HELP ME ATLEAST ON HOW TO SCROLL 2D ARRAYS.
  }

}
void latch(){
  digitalWrite(LATCH, HIGH);
  delayMicroseconds(10);
  digitalWrite(LATCH, LOW);
  delayMicroseconds(10);
}

Please edit your message and insert the code using code tags.

Do you try to add scrolling to the code? Please show your efforts.

Adafruit would be better

It looks like you are just outputting data to 0,0

For that, you'll need a custom bitmap code like my one


void dBCram(int x, int y, uint16_t *data, int datasx, int datasy, int sx, int sy)
{
  int px = (floor(sx / datasx));
  int py = (floor(sy / datasy));
  int w = px * datasx;
  int h = py * datasy;
  int tc = 0;
  for (int Y = 0; Y < h; Y = Y + py)
  {
    for (int X = 0; X < w; X = X + px)
    {

      pixel(X + x, Y + y, px, py, data[tc]);
      if (tc < h * w) tc++;
    }
  }
}
void dBCrom(int x, int y, int sx, int sy, uint16_t *data, int datasx, int datasy)
{
  int px = ((sx / datasx));
  int py = ((sy / datasy));
  int w = px * datasx;
  int h = py * datasy;
  int tc = 0;
  for (int Y = 0; Y < h; Y = Y + py)
  {
    for (int X = 0; X < w; X = X + px)
    {

      pixel(X + x, Y + y, px, py, pgm_read_word(&data[tc]));
      if (tc < h * w) tc++;
    }
  }
}

since i didnt used dot matrix displays i cant give you full code but i see videos using adafruit gfx, so you can edit it for adafruit gfx or ur code

@gaouser
Please do not advice in the field that you don't understand...
Your code is not for dot matrix displays.

actually adafruit supports them which i used before going to ESP32 with tft_espi

Address any LED in your 8x8...

I want to use a shift register and I dont want to use modules because it will not gonna build up my basic skills at this field. I just want to leard how to shift a 2D array 1 at a time

yes indeed.

I've read about memcpy, memmove etc. but I dont know where to start. I already added
smile[i] = smile[]>>1
it works!! but sadly it only scrolls to the right and returns to the middle instead of travveling to the left then returning from the right.

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