#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

// Initialize the display
U8G2_MAX7219_32X8_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE);

void setup(void) {
  // Begin the display
  u8g2.begin();
  // Set the display contrast
  u8g2.setContrast(160);
}

void loop(void) {
  // Set the font for the display
  u8g2.setFont(u8g2_font_victoriabold8_8r);
  
  // Calculate the width of the string
  int strWidth = u8g2.getStrWidth("HI I AM KAI29 FROM THAI HAVE A NICE DAY");
  
  // Loop to scroll the text from right to left
  for (int i = 32; i >= -strWidth; i--) {
    u8g2.clearBuffer(); // clear the internal memory
    u8g2.drawStr(i, 8, "I AM KAI29 FROM THAI HAVE A NICE DAY"); // write something to the internal memory
   
   
   
    u8g2.sendBuffer(); // transfer internal memory to the display
    delay(100); // delay between each scroll step
  }
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
matrix1:V+
matrix1:GND
matrix1:DIN
matrix1:CS
matrix1:CLK
matrix1:V+.2
matrix1:GND.2
matrix1:DOUT
matrix1:CS.2
matrix1:CLK.2