Go Down

Topic: SLR2016 5x7 LED OSRAM Opto Semiconductors and the Arduino code to run them (Read 18484 times) previous topic - next topic

brassbuilder

And....it appears I need to add all my pins to the pinMode, right?
Mike

PaulRB

The SLR2016_D[] is an array that should hold the pin numbers of only the data pins for the display, not the other pins too. You dont need #defines for those data pins as well.

In other words, my example code above just needed you to adjust the pin numbers, not add any more #defines or elements to the array.

You dont need to #define the other pins (after all, what would you define them as?)

Hope that anwers your questions. Your choice of Arduino pins should be fine.

So does it work?

PaulRB

And....it appears I need to add all my pins to the pinMode, right?
No, it should be all there.

brassbuilder

The SLR2016_D[] is an array that should hold the pin numbers of only the data pins for the display, not the other pins too. You dont need #defines for those data pins as well.

In other words, my example code above just needed you to adjust the pin numbers, not add any more #defines or elements to the array.

You dont need to #define the other pins (after all, what would you define them as?)

Hope that anwers your questions. Your choice of Arduino pins should be fine.

So does it work?
Yes....that did answer my questions :)

It works....sort of. I reread your intent with the code and it appears it is to cycle through the alphabet starting with A in the first position.

It cycles through x, y, z and {. It starts at Digit 0 (far right digit), then goes to Digit 2 (second from left), then Digit 1 (second from right) and then finally Digit 3 (far left). The exception is the bracket. It only does Digit 0 and Digit 2 and then the process repeats itself.

And is this code specific to Arduino or is it C++ or something?

Thanks!

Mike

brassbuilder

BTW....the brackets I'm getting are 2 { brackets and not a set of {} brackets.

PaulRB

Sounds like you may not have connected it up as you intended to in your previous post. Some of the data and address pins mixed up?

My example code sets A0 & A1 to low, so only the leftmost character should ever appear, but if you accidentally swapped some data and address pins, that would explain it.

Arduino language is indeed C++ with some standard libraries which provide digitalWrite(), pinMode(), bitRead() etc.

brassbuilder

OK...got part of it figured out. I had hooked up A0 and A1 into Digital 3 and 4 on the Arduino. I moved them to Analog A0 and A1.

But it is still just cycling through x, y, z and { (One bracket now).

And just the left digit is lit now.

Mike


brassbuilder

Interesting....not sure what I did.

I recompiled the code and reloaded it. Now it is scrolling through x, y, z and two brackets starting from the right digit and moving across sequentially....

I moved the A0 and A1 back to pins 4 and 3 respectively on the Arduino because that is how the #define has them.

Anything else I can try?

I really appreciate the help. I am googling the heck out of this too. I'm trying to learn what is going on. I used to be able to code with VisualBasic in Access databases, but that has been more years in the past than I care to remember.

Mike


brassbuilder

OK....I disconnected EVERYTHING and started over.

My pin layout is exactly like this"

From SLR2016 to Arduino

1 Write  2
2 A1      3
3 A0      4
4 Vcc     5v
5 D0      5
6 D1      6
7 D2      7
8 D3      8
9 D4      9
10 D5    10
11 D6    11
12 Blank 5v
13 Clear 5v
14 GND  GND

The code I am running:

const byte SLR2016_D[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};

#define SLR2016_A0 4
#define SLR2016_A1 3
#define SLR2016_WR 2

void setup() {

  for (byte i = 0; i < 7; i++) {
    pinMode(SLR2016_D, OUTPUT);
  }

  pinMode(SLR2016_A0, OUTPUT);
  pinMode(SLR2016_A1, OUTPUT);
  pinMode(SLR2016_WR, OUTPUT);

}

void loop() {

  for (char c = 'A'; c <= 'Z'; c++) {

    digitalWrite(SLR2016_A0, LOW);
    digitalWrite(SLR2016_A1, LOW);

    for (byte i = 0; i < 7; i++) {
      digitalWrite(SLR2016_D, bitRead(c, i));
    }

    digitalWrite(SLR2016_WR, LOW);
    digitalWrite(SLR2016_WR, HIGH);

    delay(500);
  }
}

And it is back doing the Digit 0, Digit 2, Digit 1, Digit 3 sequence.

See anything wrong?

Mike

PaulRB

Yes, I can see straight away what's wrong. You made the same mistake as before! How many elements are supposed to be in that array?

brassbuilder

Well....by array, I am guessing you are talking about this line:

const byte SLR2016_D[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};

That is all the pins I am using on the Arduino....

I've been googling the code for the last few hours. I tried just using {2, 3, 4} and all that does is turn on all the LEDs in the display.

Mike

brassbuilder

I just tried:

const byte SLR2016_D[] = {5, 6, 7, 8, 9, 10, 11};

That is only the data pins D0 through D6.

That lets the far right display scroll A-Z with the other three displays to the left completely on.

Mike

PaulRB

Ah-ha! Now we are getting somewhere. So by "completely on" you mean all 5x7 points are lit? I guess that's normal if we don't send any data to that position on the display. And A0=A1=low is the rightmost not the leftmost. Excellent work Mike, I suspect the wiring is now correct!

So next is the scrolling message?

brassbuilder

I'm trying! LOL

The first three displays (from the left) change depending on my last attempt at loading code. I've been changing code all morning and loading it. I now know a lot of code that doesn't work :)

Right now, I have (from the left) y z y A-Z (scrolling). The y z y has been a little bit of everything and at one time I had them "completely lit" with all 5x7 points lit...

So yeah....let's try a scrolling message.

How about "Mary had a little lamb."

Mike


PaulRB

Ok Mike. Won't have much time to help you tomorrow (I have house guests). So Monday.

Paul

Go Up