Pages: [1]   Go Down
Author Topic: display letters 3x5 matrix  (Read 1865 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 193
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi I am having troubles on displaying letters on my 3x5 matrix as shown on pic....I would like to spell my name or anything for that matter.......schematic is shown below......i can only make it light up one letter .....if i try to light up 2 the letters will only show for about half a second, but when i put delays in so it will stay on   
longer, it only makes it worse by having the leds light up slowly. Also my next question is are u able to control the amount of times it loops and then it will go on to next command? Sorry if u dont understand.....it is hard to explain......and i am new to this so i only know the basics.


* Note_20130815_193300_01(1).jpg (68.89 KB, 800x1070 - viewed 58 times.)
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 203
Posts: 8720
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You should put the resistors on the columns instead of rows.  If you try to light 5 LEDs at once you are likely to overload your Arduino pins.  If you put the resistors on the columns and light one row at a time you will be able to put 10 mA through each LED without overloading the pins.

Sounds likely that your main problem is in software.  Perhaps if you showed your sketch we could point to improvements.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Full Member
***
Karma: 1
Posts: 193
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I cant copy it .....it wont let me......and what about my second question
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26570
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How many variations of this thread/control question do you have going now dbutler0526?
Using blink without delay techniques, you only have to cycle thru 15 LEDs.
Code:
byte anodeArray[] = {2,3,4,}; // write High to drive anodes
byte columnCount = 0;
byte cathodeArray[] ={5,6,7,8,9,}; // write Low to drive cathodes
byte rowCount = 0;
byte LEDstate; // will be 0 or 1 to follow 3 right hand bits of displayArray
byte displayArray[] = {every 5 bytes is the next letter, put your message here
0b00000111; // 0
0b00000101;
0b00000101;
0b00000101;
0b00000111;

0b00000010; // 1
0b00000110;
0b00000010;
0b00000010;
0b00000111;

etc.

void loop(){
currentTime = millis();
if ( (currentTime - previousTime) >=multiplexDuration){ // 1mS here, go thru all LEDs every 15mS
previousTime = previousTime + multiplexDuration;
// turn on the next LED
digitalWrite (anodeArray[columnCount], LOW); // turn off prior LED
digitalWrite(cathodeArray[rowCount], HIGH); // turn off prior LED
columnCount = columnCount +1; // get ready for the next one
if (columnCount == 3){ // reset, increment the rows
rowCount = rowCount +1;
if (rowCount == 5){ reset
rowCount = 0:
// now turn on next LED some magic & determine the state of the. Overall this is getting close, with 1 set of time and location variables for multipling the display, and a second set of time and location variables to point to display array to track What wil be display - now to finish up the 2nd set, and mix the multiplex with the What. Give it a shot, I'm going to bed...
digitalWrite (anodeArray[columnCount],displayArray[LEDstate]); // anode High if 3x5 array is high
digitalWrite (cathodeArray[rowCount], LOW);
}
if ( (currentTime - previousTime2) >= frameDuration){
previousTime2 = previousTime2 + frameDuration;
displayRow = displayRow +5;
if (displayRow == 30){
displayRow= 0;
//update the displayArray for the next letter
}
}
« Last Edit: September 03, 2013, 07:55:48 am by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

NSW Australia
Offline Offline
Faraday Member
**
Karma: 80
Posts: 3254
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I cant copy it ... it wont let me

If perchance you are using Linux, the Arduino IDE is non-compliant and the "mouse paste" does not work.  You have to use mark (or Ctrl-A) - Ctrl-C - Ctrl-V like Windoze.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26570
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

dbutler, try this out.
Read the pin assignments, connect accordingly, or tweak to what you have connected already.
I haven't compiled this, its more of a thought process.
You can see how there are 2 time loops going on.
One multiplexes thru the 15 LEDs, the other advances thru an array holding the message that will be displayed.

Code:

http://forum.arduino.cc/index.php?topic=185922.0;topicseen
byte anodeArray[] = {2,3,4,}; // write High to drive anodes
byte columnCount = 0b00000001; // will use 0b00000001, 0b00000010, 0b00000100 - see font definitions
byte cathodeArray[] ={5,6,7,8,9,}; // write Low to drive cathodes
byte rowCount = 0; // will use 01,2,3,4
byte BITstate; // will be 0,1,2,4
byte LEDstate; // will be HIGH or LOW
byte displayArray[] = {
//every 5 bytes is the next letter, put your message here
0b00000111, // 0
0b00000101,
0b00000101,
0b00000101,
0b00000111,

0b00000010, // 1
0b00000110,
0b00000010,
0b00000010,
0b00000111,

0b00000111, // 2
0b00000001,
0b00000111,
0b00000100,
0b00000111,

0b00000111, // 3
0b00000001,
0b00000111,
0b00000001,
0b00000111,

0b00000101, // 4
0b00000101,
0b00000111,
0b00000001,
0b00000001,

0b00000111, // 5
0b00000100,
0b00000111,
0b00000001,
0b00000111,

// etc.
}
unsigned long currentTime;
unsigned long previousTime = 0;
unsigned long previousTime2 = 0;
unsigned long multiplexDuration = 1000; // micros = 1mS
unsigned long  frameDuration = 500000UL; // micros = 0.5S

void setup(){
for (x=2; x<10; x=x+1){
pinMode (2, OUTPUT); // enanble outputs, default state is LOW
}
for (x=5; x<10; x=x+1){
digitalWrite (5,  HIGH); // cathode HIGH
}
} // end setup
void loop(){
currentTime = micros();
// Time to update the multiplexing?
if ( (currentTime - previousTime) >=multiplexDuration){ // 1mS here, go thru all LEDs every 15mS
previousTime = previousTime + multiplexDuration;
// turn on the next LED
digitalWrite (anodeArray[columnCount], LOW); // turn off prior LED
digitalWrite(cathodeArray[rowCount], HIGH); // turn off prior LED
columnCount = columnCount << 1; // get ready for the next one
if (columnCount == 0b00001000){ // reset, increment the rows
columnCount = 0b00000001;
rowCount = rowCount +1;
if (rowCount == 5){ // reset
rowCount = 0:
// now turn on next LED
// displayRow +rowCount - determines 0-4, 5-9, 10-14, 15-19, 20-24, 25-29
// columnCount - instead of  0,1,2 use 1, 2, 4 & mask the byte: 0b00000001, 0b00000010, 0b00000100
// point to a row in displayArray, pick off one bit at a time - work from right to left, top to bottom
BITstate = displayArray[displayRow+rowCount] & columnCount; // result is 0, or 1, 2, 4
if (BITstate == 0){ LEDstate = LOW;}
else {(LEDstate = HIGH);}

digitalWrite (anodeArray[columnCount],displayArray[LEDstate]); // anode High if 3x5 array point is high
digitalWrite (cathodeArray[rowCount], LOW);
}
// Time to show a new letter?
if ( (currentTime - previousTime2) >= frameDuration){
previousTime2 = previousTime2 + frameDuration;
displayRow = displayRow +5;
if (displayRow == 30){ // make this as long as the number of character to show. This assumes 6 characters
displayRow= 0;
//update the displayArray for the next letter
}

} // end loop
« Last Edit: September 03, 2013, 09:38:39 am by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 1
Posts: 193
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Im sorry for so many thread, i didnt get any response from the one till now so i tried a different title lol.....sorry .....im done with all the questions i think i got the hang of it .....thanks
Logged

Pages: [1]   Go Up
Jump to: