Go Down

### Topic: Newby needs help with Scrolling text help (Read 1 time)previous topic - next topic

##### Jan 01, 2013, 09:13 pm
I am a newby with arduino and i am trying to build a 6x12 scrolling text matrix. I used the code and instructions from here http://www.instructables.com/id/810-LED-Matrix-with-4017/.  I just made a few changes experimenting to see if I could get the 8x10 code it to work on a 6x12.
here is a video of what it is doing. I have it programmed to show 2 dots scrolling from right to left, but the coding or wiring is off so I cant get it to work.

it is wired from right to left on the perforboard, to pins 0-7, 10-13. pins 8 and 9 go to the 4017.

here is the code that i am using, again I didn't write the code, I have PTSD and I keep forgetting what I have learned.
Code: [Select]
// 10*8 LED matrix with 4017 IC
//On 25.06.2009

int clock = 9;// goes to the clock pin on the 4017 IC
int reset = 8;//goes to the reset pin on the 4017 IC
int RED = 10;//
int BLUE = 11;//
int GREEN = 12;//
int BLACK = 13;//
//x,y for the loop
int x;
int y;
// here the definion of all the letter(big ans small) and numbers
#define BA {B01110000,B10001000,B10001000,B11111000,B10001000,B10001000}
#define BB {B11110000,B10001000,B10001000,B11110000,B10001000,B11111000}
#define BC {B11111000,B10000000,B10000000,B10000000,B10000000,B11111000}
#define BD {B11110000,B10001000,B10001000,B10001000,B10001000,B11110000}
#define BE {B11111000,B10000000,B10000000,B11110000,B10000000,B11111000}
#define BF {B11111000,B10000000,B10000000,B11110000,B10000000,B10000000}
#define BG {B01110000,B10001000,B10000000,B10011000,B10001000,B01110000}
#define BH {B10001000,B10001000,B11111000,B10001000,B10001000,B10001000}
#define BI {B11111000,B00100000,B00100000,B00100000,B00100000,B11111000}
#define BJ {B00111000,B00010000,B00010000,B00010000,B10010000,B01100000}
#define BM {B10001000,B11011000,B10101000,B10101000,B10001000,B10001000}
#define BN {B10001000,B11001000,B10101000,B10101000,B10011000,B10001000}
#define BL {B10000000,B10000000,B10000000,B10000000,B10000000,B11111000}
#define BO {B01110000,B10001000,B10001000,B10001000,B10001000,B01110000}
#define BP {B11110000,B10001000,B10001000,B11110000,B10000000,B10000000}
#define BQ {B01110000,B10001000,B10101000,B10011000,B01111000,B00001000}
#define BR {B11110000,B10001000,B10001000,B11110000,B10001000,B10001000}
#define BS {B01110000,B10001000,B01100000,B00010000,B10001000,B01110000}
#define BK {B10001000,B10010000,B11100000,B11100000,B10010000,B10001000}
#define BT {B11111000,B00100000,B00100000,B00100000,B00100000,B00100000}
#define BU {B10001000,B10001000,B10001000,B10001000,B10001000,B01110000}
#define BV {B10001000,B10001000,B10001000,B10001000,B01010000,B00100000}
#define BW {B10001000,B10001000,B10101000,B10101000,B10101000,B01010000}
#define BX {B10001000,B01010000,B00100000,B00100000,B01010000,B10001000}
#define BY {B10001000,B01010000,B00100000,B00100000,B00100000,B00100000}
#define BZ {B11111000,B00001000,B00110000,B01100000,B10000000,B11111000}
#define LA{B00000000,B01110000,B00001000,B01111000,B10001000,B01111000}
#define LB{B10000000,B10000000,B10110000,B11001000,B10001000,B11110000}
#define LC{B00000000,B01110000,B10000000,B10000000,B10001000,B01110000}
#define LD{B00001000,B00001000,B01111000,B10001000,B10001000,B01111000}
#define LE{B00000000,B01110000,B10001000,B11111000,B10000000,B01110000}
#define LF{B00110000,B01001000,B01000000,B11100000,B01000000,B01000000}
#define LG{B00000000,B01111000,B10001000,B01111000,B00001000,B01110000}
#define LH{B10000000,B10000000,B10110000,B11001000,B10001000,B10001000}
#define LI{B00100000,B00000000,B01100000,B00100000,B00100000,B01111000}
#define LJ{B00010000,B00000000,B00111000,B00010000,B10010000,B01100000}
#define LK{B10000000,B10010000,B10100000,B11000000,B10100000,B10010000}
#define LL{B01100000,B00100000,B00100000,B00100000,B00100000,B01111000}
#define LM{B00000000,B00000000,B11010000,B10101000,B10101000,B10001000}
#define LN{B00000000,B00000000,B10110000,B11001000,B10001000,B10001000}
#define LO{B00000000,B01110000,B10001000,B10001000,B10001000,B01110000}
#define LP{B00000000,B11110000,B10001000,B11110000,B10000000,B10000000}
#define LQ{B00000000,B01101000,B10011000,B01111000,B00001000,B00001000}
#define LR{B00000000,B00000000,B10110000,B11001000,B10000000,B10000000}
#define LS{B00000000,B01110000,B10000000,B01110000,B00001000,B11110000}
#define LT{B01000000,B01000000,B11100000,B01000000,B01001000,B00110000}
#define LU{B00000000,B00000000,B10001000,B10001000,B10011000,B01101000}
#define LV{B00000000,B00000000,B10001000,B10001000,B01010000,B00100000}
#define LW{B00000000,B00000000,B10001000,B10101000,B10101000,B01010000}
#define LX{B00000000,B10001000,B01010000,B00100000,B01010000,B10001000}
#define LY{B00000000,B10001000,B10001000,B01111000,B00001000,B01110000}
#define LZ{B00000000,B11111000,B00010000,B00100000,B01000000,B11111000}
#define SPACE{B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define NUM0{B01110000,B10011000,B10101000,B10101000,B11001000,B01110000}
#define NUM1{B00100000,B01100000,B10100000,B00100000,B00100000,B01110000}
#define NUM2{B01110000,B10001000,B00001000,B01110000,B10000000,B11111000}
#define NUM3{B11110000,B00001000,B00001000,B01111000,B00001000,B11110000}
#define NUM4{B10001000,B10001000,B10001000,B11111000,B00001000,B00001000}
#define NUM5{B11111000,B10000000,B11110000,B00001000,B10001000,B01110000}
#define NUM6{B11111000,B10000000,B11111000,B10001000,B10001000,B11111000}
#define NUM7{B11111000,B00001000,B00001000,B01111000,B00001000,B00001000}
#define NUM8{B11111000,B10001000,B11111000,B10001000,B10001000,B11111000}
#define NUM9{B11111000,B10001000,B11111000,B00001000,B00001000,B11111000}
#define DEVIDE{B00001000,B00010000,B00100000,B00100000,B01000000,B10000000}
#define TWODOTS{B01100000,B01100000,B00000000,B00000000,B01100000,B01100000}
#define DOT{B00000000,B00000000,B00111000,B00111000,B00000000,B0000000}
#define COMA{B00000000,B00000000,B00000000,B00110000,B00110000,B01100000}
#define LINE{B00000000,B00000000,B11111000,B11111000,B00000000,B00000000}
#define QUASTION{B01110000,B10001000,B00010000,B00100000,B00000000,B00100000}
#define MARK{B00100000,B01110000,B01110000,B00100000,B00000000,B00100000}

const int numPatterns = 16;//this is the number of patterns you want to display
byte patterns[numPatterns][10]={SPACE,TWODOTS,SPACE,TWODOTS,};// the patterns order
void setup(){
DDRD=B11111111;  // this is a commed that makes pins 0-7 outputs(see more on the arduino site)
//simple stuff here
pinMode(clock,OUTPUT);
pinMode(reset,OUTPUT);
pinMode (RED,OUTPUT);
pinMode (BLUE,OUTPUT);
pinMode (GREEN,OUTPUT);
pinMode (BLACK,OUTPUT);
//reseting the 4017 IC, you have to do this
digitalWrite(reset,HIGH);
delayMicroseconds(5);
digitalWrite(reset,LOW);
}

void display_pattern(int loops)//int loop acts like a delay, it take 8 mSecands to scan all of the rows so int loops = 15 is a good time for it
{
for(x=0;x<numPatterns-1;x++){ // loop over the patterns
for (int z=0;z<6;z++){ //scrolls one bite at a time
for(int t=0;t<loops;t++){// the delay we get with loops
for(y=0;y<10;y++){// loops over the array of bytes
byte temp = patterns[x][y];
byte temp_2=patterns[x+1][y];
byte temp_3=patterns[x][y];
PORTD = (temp<<z)+(temp_2>>7-z);//writes digital outputs, Z is for how much bites it need to scroll
PORTB = temp_2>>4-z;//writes digital outputs, Z is for how much bites it need to scroll
delayMicroseconds(800);// the time every row is one
PORTD=B00000000;// all pins are low, fixes the ghosting effect // telles the 4017 IC to go to the next row

PORTB=B00000000;// all pins are low, fixes the ghosting effect // telles the 4017 IC to go to the next row// telles the 4017 IC to go to the next row
digitalWrite(clock,HIGH);
delayMicroseconds(5);
digitalWrite(clock,LOW);

}
}
}
}
}

void loop(){
display_pattern(20);// calls for the display_pattern function and says that int loop = 15(if you do more loop the pattern whould scrrol slower).
}

#### johnwasser

#1
##### Jan 01, 2013, 10:46 pm
Part of the problem may be:
Code: [Select]

const int numPatterns = 16;//this is the number of patterns you want to display
byte patterns[numPatterns][10]={
SPACE,TWODOTS,SPACE,TWODOTS,};// the patterns order

Your code says you are going to display 16 patterns but you only define 4.

Try something easier to recognize:
Code: [Select]

const int numPatterns = 16;//this is the number of patterns you want to display
byte patterns[numPatterns][10]={
NUM0,NUM1,NUM2,NUM3,NUM4,NUM5,NUM6,NUM7,NUM8,NUM9,BA,BB,BC,BD,BE,BF};
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

#2
##### Jan 01, 2013, 11:21 pm
Like I said I am a newby at this, I'm not even sure what the 16 stands for.

#### JavaMan

#3
##### Jan 02, 2013, 12:29 am
Not sure about everything that is wrong (especially the wiring), but the decade counter must be reset after every character. You are doing it only once in the setup(). Also the clock must be pulsed once for each row, but it looks like you are doing it for every column of every row.

#4
##### Jan 17, 2013, 06:35 pm
Can anyone help me either re-write the code or make a new one? It is a 6 rows and 12 columns connected to a 4017 and the arduino. I just want it to scroll text so I can use it at my hot dog wagon. I don't have shift registers and am not very familar with writing code.

thanks,
Semper Fi
Joe

#5
##### Jan 17, 2013, 06:46 pm
Can anyone help me either re-write the code or make a new one? It is a 6 rows and 12 columns connected to a 4017 and the arduino. I just want it to scroll text so I can use it at my hot dog wagon. I don't have shift registers and am not very familar with writing code.

thanks,
Semper Fi
Joe

#### johnwasser

#6
##### Jan 17, 2013, 07:13 pm
You might be better off buying a commercial unit.

Here is a 12x36 model for \$28.07:
http://www.ledoes.com/product/197918-50629100-led-signs-red-12x36-pixels-software-input-by-usb-cable-scrolling-message-rechargeable-wholesalers.html

This one says 7x40 for \$32:
http://www.powerledworld.com/en/red-12v-car-led-programmable-message-sign-scrolling-display-board-with-remote.html?language=en&currency=USD

Here is a 16x69 display for \$59.99:
http://www.meritline.com/led-sign-board-great-for-point-of-sale---p-86995.aspx?source=fghdac
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Go Up