Void Rainbow on Scrolling Text

#include <Adafruit_NeoPixel.h>

#define CLR_WHITE 8
#define CLR_RED 2


const int led_row =5;
const int led_col=24;
int led_count= led_row *led_col;

Adafruit_NeoPixel strip = Adafruit_NeoPixel (led_count,2,NEO_GRB + NEO_KHZ800);

byte value_r=255;
byte value_g=0;
byte value_b=0;
byte color_in_row[12];
int index_animasi=0;

byte color_data[9][3]{
  {0,255,255},
  {255,255,0},
  {255,0,0},
  {0,255,0},
  {0,0,255},
  {0,255,255},
  {255,0,0},
  {0,0,255},
  {255,255,255}
};

const byte font_wave[] PROGMEM ={
        0x1C, 0x0A, 0x09, 0x0A, 0x1C,0x00,      // Code for char A
        0x1F, 0x15, 0x15, 0x15, 0x0A,0x00,      // Code for char B
        0x1F, 0x11, 0x11, 0x11, 0x11,0x00,      // Code for char C
        0x1F, 0x11, 0x11, 0x11, 0x0E,0x00 ,     // Code for char D
        0x1F, 0x15, 0x15, 0x15, 0x15,0x00,      // Code for char E
        0x1F, 0x05, 0x05, 0x05, 0x05,0x00,      // Code for char F
        0x1F, 0x11, 0x15, 0x15, 0x1D,0x00,      // Code for char G
        0x1F, 0x04, 0x04, 0x04, 0x1F,0x00,      // Code for char H
        0x11, 0x11, 0x1F, 0x11, 0x11,0x00,      // Code for char I
        0x08, 0x10, 0x10, 0x10, 0x0F,0x00,      // Code for char J
        0x1F, 0x04, 0x0E, 0x1B, 0x11,0x00,      // Code for char K
        0x1F, 0x10, 0x10, 0x10, 0x10,0x00,      // Code for char L
        0x1F, 0x02, 0x04, 0x02, 0x1F,0x00,      // Code for char M
        0x1F, 0x02, 0x04, 0x08, 0x1F,0x00,      // Code for char N
        0x0E, 0x11, 0x11, 0x11, 0x0E,0x00,      // Code for char O
        0x1F, 0x05, 0x05, 0x05, 0x07,0x00,      // Code for char P
        0x0E, 0x11, 0x15, 0x09, 0x16,0x00,      // Code for char Q
        0x1F, 0x05, 0x0D, 0x15, 0x02,0x00,      // Code for char R
        0x12, 0x15, 0x15, 0x15, 0x09,0x00,      // Code for char S
        0x01, 0x01, 0x1F, 0x01, 0x01,0x00,      // Code for char T
        0x0F, 0x10, 0x10, 0x10, 0x0F,0x00,      // Code for char U
        0x07, 0x08, 0x10, 0x08, 0x07,0x00,      // Code for char V
        0x1F, 0x08, 0x04, 0x08, 0x1F,0x00,      // Code for char W
        0x11, 0x0A, 0x04, 0x0A, 0x11,0x00,      // Code for char X
        0x01, 0x02, 0x1C, 0x02, 0x01,0x00,      // Code for char Y
        0x11, 0x19, 0x15, 0x13, 0x11,0x00,      // Code for char Z
};

const byte module_max=10;
byte data_col[module_max*12];

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Belajar Strobo #Eps.02 ShareAnimasi 001");
  strip.begin();
  strip.show();
  
  String s="HINO";
  int c=0;
    for (byte a=0;a<s.length();a++){
    int index_char=s[a]-65;
      for(byte i=0;i<6;i++){
      byte b=pgm_read_byte(&font_wave[index_char*6+i]);
      data_col[c]=b;
      c++;
        if (b==0){
        }
        else{
        }
      }
    }
  for (int z=0;z<s.length()*6+24;z++){  
  pixel_shift(); 
  //pixel_print();
  pixel_show();  
  }
}

void loop() {
  //animation_text();
}
    
void pixel_show(){
  for(byte c=0;c<led_col;c++){
      for (int r=0;r<5;r++){
      byte b=bitRead(data_col[c+21],r);
      int index_led=led_from_pixel(4-r,c);  
        if (b==1){
              strip.setPixelColor(index_led, Wheel(255));
        }
        else{
          strip.setPixelColor(index_led,strip.Color(0,0,0));
        }
      Serial.print(b);
      Serial.print(" "); 
      }
  Serial.println();
  strip.show();
  }
}

void pixel_print(){
  int j=4;
  for(int r=0;r<5;r++){
      for (int c=0;c<led_col;c++){
      byte b=bitRead(data_col[c+j*6],r);
      int index_led=led_from_pixel(4-r,c);  
        if (b==1){
              strip.setPixelColor(index_led, Wheel((r+c) & 255));
        }
        else{
          strip.setPixelColor(index_led,strip.Color(0,0,0));
        }
      Serial.print(b);
      Serial.print(" "); 
      }
  Serial.println();
  strip.show();
  }
}

void pixel_shift(){
  for (int c=60;c>0;c--){
    data_col[c]=data_col[c-1];
    data_col[c-1]=0;
  }
}

int led_from_pixel(byte row,byte col){
  int a=0;
  if (row%2==0){
    a=(row*led_col)+col;
  }
  else{
    a=((row+1)*led_col)-1-col;
  }
  return a;
}

uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

Hi guys can somebody help me with the programming code of scrolling text with the variation of rainbow color

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