Pages: 1 [2]   Go Down
Author Topic: Mix and match HT1632C based LED Boards  (Read 1730 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Out of all the examples in the folder

circle
demo
fill
geometry
life
line
pong

I can only get "fill" to work.

Arduino IDE 23-1.05
AtMega328
HT1632C


Does the Arduino IDE version make a difference?

Thanks for your help,

Randy
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does this sketch look right?
It uses plot like you said.

Code:
#include <de_dp11xxx.h>

de_dp11xxx ledMatrix = de_dp11xxx(PORTD, 2, 3, 4, 5, 0, 0, 2);

void setup() {
  ledMatrix.clear();
}

void loop() {
  byte x,y, neighbors, newval;

  ledMatrix.plot(12,9,1);  // Plant an "acorn"; a simple pattern that
  ledMatrix.plot(14,10,1); //  grows for quite a while..
  ledMatrix.plot(11,11,1);
  ledMatrix.plot(12,11,1);
  ledMatrix.plot(15,11,1);
  ledMatrix.plot(16,11,1);
  ledMatrix.plot(17,11,1);

  ledMatrix.plot(10,9,1);  // Plant an "acorn"; a simple pattern that
  ledMatrix.plot(12,10,1); //  grows for quite a while..
  ledMatrix.plot(9,11,1);
  ledMatrix.plot(10,11,1);
  ledMatrix.plot(13,11,1);
  ledMatrix.plot(14,11,1);
  ledMatrix.plot(15,11,1);

  delay(1000);   // Play life
  ledMatrix.sendframe();

  while (1) {
    for (x=1; x < ledMatrix.x_max; x++) {
      for (y=1; y < ledMatrix.y_max; y++) {
        neighbors = ledMatrix.getpixel(x, y+1) +
          ledMatrix.getpixel(x, y-1) +
          ledMatrix.getpixel(x+1, y) +
          ledMatrix.getpixel(x+1, y+1) +
          ledMatrix.getpixel(x+1, y-1) +
          ledMatrix.getpixel(x-1, y) +
          ledMatrix.getpixel(x-1, y+1) +
          ledMatrix.getpixel(x-1, y-1);

        switch (neighbors) {
        case 0:
        case 1:
          newval = 0;   // death by loneliness
          break;
        case 2:
          newval = ledMatrix.getpixel(x,y);
          break;  // remains the same
        case 3:
          newval = 1;
          break;
        default:
          newval = 0;  // death by overcrowding
          break;
        }
        ledMatrix.plot(x,y, newval);
      }
    }
    ledMatrix.sendframe();
    delay(1000);
  }
  delay(1000);
}
/code]
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd suggest you try using plot function first.
BTW I have different code for driving 24x16 LED matrix display. I've modified it to run on 4 dp11111 displays (it can split screen real-estate between top 2 and bottom 2 displays.  I use it in my Xronos Mega Clock prototype, but it works on ATMega1284p. Take a look, maybe you'll find it useful. It should work with one display, just play with settings in LED_2416.h file.


Thanks for the files I have been able to use the plot function with great success but have not had any luck getting the Game of Life sketch to read which led's are on and off and then make the necessary changes. Is there a problem with the sketch? Or is it my Arduino? I am sure I have it connected right because the plot works.

Cheers

Logged

New York
Offline Offline
Sr. Member
****
Karma: 3
Posts: 362
xronosclock.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Thanks for the files I have been able to use the plot function with great success but have not had any luck getting the Game of Life sketch to read which led's are on and off and then make the necessary changes. Is there a problem with the sketch? Or is it my Arduino? I am sure I have it connected right because the plot works.

Cheers
[/quote]
Well since plot works looks like you have everything connected right. I have no experience with Game of Life, so I can't help you there.
BTW I don't think you can read which LEDs are on/off, it has to be tracked in some kind of buffer in your sketch. Or I could be wrong... Hopefully someone who wrote library can respond...
Logged

Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info smiley

0
Offline Offline
Newbie
*
Karma: 0
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you'r right. Which I am thinking must be harder to do on an Arduino? What would be a close language match that I can look up and try and change someone else's code. Would C++ code be close enough for me to hack?
Logged

Pages: 1 [2]   Go Up
Jump to: