Running Text with WS1903

I have a problem with the coding of led strip to make it into the running 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, // Code for char A
0x1F, 0x15, 0x15, 0x15, 0x0A, // Code for char B
0x1F, 0x11, 0x11, 0x11, 0x11, // Code for char C
0x1F, 0x11, 0x11, 0x11, 0x0E, // Code for char D
0x1F, 0x15, 0x15, 0x15, 0x15, // Code for char E
0x1F, 0x05, 0x05, 0x05, 0x05, // Code for char F
0x1F, 0x11, 0x15, 0x15, 0x1D, // Code for char G
0x1F, 0x04, 0x04, 0x04, 0x1F, // Code for char H
0x11, 0x11, 0x1F, 0x11, 0x11, // Code for char I
0x08, 0x10, 0x10, 0x10, 0x0F, // Code for char J
0x1F, 0x04, 0x0E, 0x1B, 0x11, // Code for char K
0x1F, 0x10, 0x10, 0x10, 0x10, // Code for char L
0x1F, 0x02, 0x04, 0x02, 0x1F, // Code for char M
0x1F, 0x02, 0x04, 0x08, 0x1F, // Code for char N
0x0E, 0x11, 0x11, 0x11, 0x0E, // Code for char O
0x1F, 0x05, 0x05, 0x05, 0x07, // Code for char P
0x0E, 0x11, 0x15, 0x09, 0x16, // Code for char Q
0x1F, 0x05, 0x0D, 0x15, 0x02, // Code for char R
0x12, 0x15, 0x15, 0x15, 0x09, // Code for char S
0x01, 0x01, 0x1F, 0x01, 0x01, // Code for char T
0x0F, 0x10, 0x10, 0x10, 0x0F, // Code for char U
0x07, 0x08, 0x10, 0x08, 0x07, // Code for char V
0x1F, 0x08, 0x04, 0x08, 0x1F, // Code for char W
0x11, 0x0A, 0x04, 0x0A, 0x11, // Code for char X
0x01, 0x02, 0x1C, 0x02, 0x01, // Code for char Y
0x11, 0x19, 0x15, 0x13, 0x11 // Code for char Z
};

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();
}

void loop() {
animation_text();
}

void animation_text(){
int c=0; //kolom led
int j=4; //jumlah huruf
int k=5; //jumlah kolom
char chr[4]={‘H’,‘I’,‘N’,‘O’};
for(int h=0;h<j;h++){
byte index_char = chr-65;
for (int a=0;a<k;a++){
int index_char_col = index_char k;
byte b= pgm_read_byte(&font_wave[index_char_col+a]);
if (b==0){
break;
}
for (int r=0;r<5;r++){
byte b2=bitRead(b,r);
int i = led_from_pixel(4-r,c);
if (c>=led_col){
}
else{
int i=led_from_pixel(4-r,c);
if (b2==1){
strip.setPixelColor(i,strip.Color(value_r,value_g,value_b));
}
else{
strip.setPixelColor(i,strip.Color(0,0,0));
}
}
}
c++;
}
if (c>led_col){
for (int r=0;r<5;r++){
int i=led_from_pixel (r,c);
strip.setPixelColor(i, strip.Color(0,0,0));
}
}
c++;
strip.show();
delay(1000);
}
}
void color_select(int index_color){
value_r = color_data[index_color][0];
value_g = color_data[index_color][1];
value_b = color_data[index_color][2];
}
void led_off(){
for (int i=0;i<led_count;i++){

}
}
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;
}
byte led_set_brightness(byte v, byte br){
return map(v,0,255,0,br);
}

#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,      // Code for char A
        0x1F, 0x15, 0x15, 0x15, 0x0A,      // Code for char B
        0x1F, 0x11, 0x11, 0x11, 0x11,      // Code for char C
        0x1F, 0x11, 0x11, 0x11, 0x0E,      // Code for char D
        0x1F, 0x15, 0x15, 0x15, 0x15,      // Code for char E
        0x1F, 0x05, 0x05, 0x05, 0x05,      // Code for char F
        0x1F, 0x11, 0x15, 0x15, 0x1D,      // Code for char G
        0x1F, 0x04, 0x04, 0x04, 0x1F,      // Code for char H
        0x11, 0x11, 0x1F, 0x11, 0x11,      // Code for char I
        0x08, 0x10, 0x10, 0x10, 0x0F,      // Code for char J
        0x1F, 0x04, 0x0E, 0x1B, 0x11,      // Code for char K
        0x1F, 0x10, 0x10, 0x10, 0x10,      // Code for char L
        0x1F, 0x02, 0x04, 0x02, 0x1F,      // Code for char M
        0x1F, 0x02, 0x04, 0x08, 0x1F,      // Code for char N
        0x0E, 0x11, 0x11, 0x11, 0x0E,      // Code for char O
        0x1F, 0x05, 0x05, 0x05, 0x07,      // Code for char P
        0x0E, 0x11, 0x15, 0x09, 0x16,      // Code for char Q
        0x1F, 0x05, 0x0D, 0x15, 0x02,      // Code for char R
        0x12, 0x15, 0x15, 0x15, 0x09,      // Code for char S
        0x01, 0x01, 0x1F, 0x01, 0x01,      // Code for char T
        0x0F, 0x10, 0x10, 0x10, 0x0F,      // Code for char U
        0x07, 0x08, 0x10, 0x08, 0x07,      // Code for char V
        0x1F, 0x08, 0x04, 0x08, 0x1F,      // Code for char W
        0x11, 0x0A, 0x04, 0x0A, 0x11,      // Code for char X
        0x01, 0x02, 0x1C, 0x02, 0x01,      // Code for char Y
        0x11, 0x19, 0x15, 0x13, 0x11       // Code for char Z
};

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();
}

void loop() {
  animation_text();
}


void animation_text(){
  int c=0; //kolom led
  int j=4; //jumlah huruf
  int k=5; //jumlah kolom
  char chr[4]={'H','I','N','O'};
  for(int h=0;h<j;h++){
    byte index_char = chr[h]-65;
    for (int a=0;a<k;a++){
      int index_char_col = index_char *k;
      byte b= pgm_read_byte(&font_wave[index_char_col+a]);
      if (b==0){
       break; 
      }
      for (int r=0;r<5;r++){
        byte b2=bitRead(b,r);
        int i = led_from_pixel(4-r,c);
        if (c>=led_col){ 
      }
      else{
        int i=led_from_pixel(4-r,c);
        if (b2==1){
          strip.setPixelColor(i,strip.Color(value_r,value_g,value_b));
        }
        else{
          strip.setPixelColor(i,strip.Color(0,0,0));
        }
      }
    }
    c++;
  }
  if (c>led_col){
    for (int r=0;r<5;r++){
      int i=led_from_pixel (r,c);
      strip.setPixelColor(i, strip.Color(0,0,0));
    }
  }
  c++;
  strip.show();
  delay(1000);
  }
}

void color_select(int index_color){
  value_r = color_data[index_color][0];
  value_g = color_data[index_color][1];
  value_b = color_data[index_color][2];
}

void led_off(){
  for (int i=0;i<led_count;i++){
    
  }
}

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;
}

byte led_set_brightness(byte v, byte br){
  return  map(v,0,255,0,br);
}

im using addresable led strip ws1903 with 1IC for 3 led

What does it do or not do, how does that differ from what you intend?

Also good thing you never call led_off because it doesn't. Turn all you LEDs off.

Work with us here!

a7

What it does right now is turn the word one by one on, whati want is to make it scroll the text, because i kind confuse when i use the for (int colomn=0;colomn<led-col;colomn ++ is error

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