Nootropic v2 Problems

Store Forums RGB Matrix Backpack Bugs/Problems Nootropic v2 Problems

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #783
    MysticForce
    Member

    Michael,
    I just got my Nootropic v2 board from adafruit.com and when I hooked it up to my 32×32 rgb matrix with a hub75 connector this is what I got. http://youtu.be/BPkvr2PwzC8 I tried to upload the video here, but had no luck so I put it up on my youtube channel. it plays everything on the top and bottom half. I have checked out all the solder connection and look over the board twice and I can not figure out what is wrong. I am using your MatrixDemo_v2 code. I have a 5v 20 amp power supply. The matrix works fine when I hook it up to my Arduino mega 2560. Can you please help. I am at my wits end as to why this don’t work. Thanks

    -Dave

    P.S. – Here is the code I am loading just in case.


    #include "Adafruit_GFX.h"
    #include "RGBmatrixPanel.h"

    #define CLK 8
    #define LAT 10 // use A3 for v1 board
    #define OE 9
    #define SIZEOF_BITMAP 24
    #define PACMAN_BITMAP (pacman_bitmaps)
    #define PACMAN_LEFT_BITMAP (pacman_bitmaps+(SIZEOF_BITMAP * 6))
    #define GHOST_BITMAP (pacman_bitmaps+(SIZEOF_BITMAP*12))
    #define GHOST_EYES (GHOST_BITMAP+(SIZEOF_BITMAP*2))
    #define GHOST_FACE (GHOST_BITMAP+(SIZEOF_BITMAP*3))
    #define SCORE (pacman_bitmaps+(SIZEOF_BITMAP * 16))
    #define SIZEOF_INVADER_BITMAP 18
    #define INVADER0_BITMAP (invader_bitmaps)
    #define INVADER1_BITMAP (invader_bitmaps+(SIZEOF_INVADER_BITMAP*2))
    #define INVADER2_BITMAP (invader_bitmaps+(SIZEOF_INVADER_BITMAP*4))
    #define N 0
    #define O 1
    #define T 2
    #define R 3
    #define P 4
    #define I 5
    #define C 6
    #define D 7
    #define E 8
    #define S 9
    #define G 10

    #define PACMAN_START -11
    #define GHOST_START -35
    #define Y 3

    const unsigned char PROGMEM pacman_bitmaps[] = {

    // open

    11,11,
    0b00001110,0b00000000,
    0b00111111,0b10000000,
    0b01111111,0b00000000,
    0b01111110,0b00000000,
    0b11111100,0b00000000,
    0b11111000,0b00000000,
    0b11111100,0b00000000,
    0b01111110,0b00000000,
    0b01111111,0b00000000,
    0b00111111,0b10000000,
    0b00001110,0b00000000,

    // half open
    11,11,
    0b00001110,0b00000000,
    0b00111111,0b10000000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b11111110,0b00000000,
    0b11111000,0b00000000,
    0b11111110,0b00000000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b00111111,0b10000000,
    0b00001110,0b00000000,

    // closed
    11,11,
    0b00001110,0b00000000,
    0b00111111,0b10000000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b00111111,0b10000000,
    0b00001110,0b00000000,

    // shading, open

    11,11,
    0b00010001,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b10000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b10000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00010001,0b00000000,

    // shading, half open

    11,11,
    0b00010001,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b10000000,0b00100000,
    0b00000001,0b00000000,
    0b00000000,0b00000000,
    0b00000001,0b00000000,
    0b10000000,0b00100000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00010001,0b00000000,

    // shading, closed

    11,11,
    0b00010001,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b10000000,0b00100000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b10000000,0b00100000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00010001,0b00000000,

    // left open

    11,11,
    0b00001110,0b00000000,
    0b00111111,0b10000000,
    0b00011111,0b11000000,
    0b00001111,0b11000000,
    0b00000111,0b11100000,
    0b00000011,0b11100000,
    0b00000111,0b11100000,
    0b00001111,0b11000000,
    0b00011111,0b11000000,
    0b00111111,0b10000000,
    0b00001110,0b00000000,

    // left half open
    11,11,
    0b00001110,0b00000000,
    0b00111111,0b10000000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b00001111,0b11100000,
    0b00000011,0b11100000,
    0b00001111,0b11100000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b00111111,0b10000000,
    0b00001110,0b00000000,

    // left closed
    11,11,
    0b00001110,0b00000000,
    0b00111111,0b10000000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b00111111,0b10000000,
    0b00001110,0b00000000,

    // left shading, open

    11,11,
    0b00010001,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00100000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00100000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00010001,0b00000000,

    // left shading, half open

    11,11,
    0b00010001,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b10000000,0b00100000,
    0b00010000,0b00000000,
    0b00000000,0b00000000,
    0b00010000,0b00000000,
    0b10000000,0b00100000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00010001,0b00000000,

    // left shading, closed

    11,11,
    0b00010001,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b10000000,0b00100000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b10000000,0b00100000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00010001,0b00000000,

    // ghost pattern 1
    11,11,
    0b00001110,0b00000000,
    0b00111111,0b10000000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11001110,0b01100000,

    // ghost pattern 2
    11,11,
    0b00001110,0b00000000,
    0b00111111,0b10000000,
    0b01111111,0b11000000,
    0b01111111,0b11000000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b11111111,0b11100000,
    0b10011011,0b00100000,

    // ghost eyes (white)
    11,11,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00011101,0b11000000,
    0b00011101,0b11000000,
    0b00011101,0b11000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,

    // blue ghost face (pink)
    11,11,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00011011,0b00000000,
    0b00011011,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00010101,0b00000000,
    0b00101010,0b10000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,

    // 200
    11,11,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b01000100,0b01000000,
    0b10101010,0b10100000,
    0b00101010,0b10100000,
    0b01001010,0b10100000,
    0b11100100,0b01000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b00000000,0b00000000


    };

    const unsigned char invader_bitmaps[] PROGMEM = {


    // 0a

    11,8,
    0b00000110,0b00000000,
    0b00001111,0b00000000,
    0b00011111,0b10000000,
    0b00110110,0b11000000,
    0b00111111,0b11000000,
    0b00001001,0b00000000,
    0b00010110,0b10000000,
    0b00101001,0b01000000,


    // 0b

    11,8,
    0b00000110,0b00000000,
    0b00001111,0b00000000,
    0b00011111,0b10000000,
    0b00110110,0b11000000,
    0b00111111,0b11000000,
    0b00001001,0b00000000,
    0b00010000,0b10000000,
    0b00001001,0b00000000,

    // 1a

    11,8,
    0b00100000,0b10000000,
    0b10010001,0b00100000,
    0b10111111,0b10100000,
    0b11101110,0b11100000,
    0b01111111,0b11000000,
    0b00111111,0b10000000,
    0b00100000,0b10000000,
    0b01000000,0b01000000,

    // 1b

    11,8,
    0b00100000,0b10000000,
    0b00010001,0b00000000,
    0b00111111,0b10000000,
    0b01101110,0b11000000,
    0b11111111,0b11100000,
    0b10111111,0b10100000,
    0b10100000,0b10100000,
    0b00011011,0b00000000,

    // 2a

    11,8,
    0b00001110,0b00000000,
    0b01111111,0b11000000,
    0b11111111,0b11100000,
    0b11001110,0b01100000,
    0b11111111,0b11100000,
    0b00111111,0b10000000,
    0b01101110,0b11000000,
    0b11000000,0b01100000,

    // 2b

    11,8,
    0b00001110,0b00000000,
    0b01111111,0b11000000,
    0b11111111,0b11100000,
    0b11001110,0b01100000,
    0b11111111,0b11100000,
    0b00111111,0b10000000,
    0b01101110,0b11000000,
    0b00110001,0b10000000

    };

    const unsigned char letter_bitmaps[] PROGMEM = {

    // n
    9,8,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b11111111,0b00000000,
    0b10000001,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,

    // o
    9,8,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b01111111,0b00000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b01111111,0b00000000,

    //t
    9,8,
    0b00000000,0b00000000,
    0b01000000,0b00000000,
    0b11110000,0b00000000,
    0b01000000,0b00000000,
    0b01000000,0b00000000,
    0b01000000,0b00000000,
    0b01000000,0b10000000,
    0b00111111,0b00000000,

    //r
    9,8,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b11111111,0b00000000,
    0b10000001,0b10000000,
    0b10000000,0b00000000,
    0b10000000,0b00000000,
    0b10000000,0b00000000,
    0b10000000,0b00000000,

    //p
    9,10,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b11111111,0b00000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b11111111,0b00000000,
    0b10000000,0b00000000,
    0b10000000,0b00000000,

    // i
    1,8,
    0b10000000,
    0b00000000,
    0b10000000,
    0b10000000,
    0b10000000,
    0b10000000,
    0b10000000,
    0b10000000,

    // c
    9,8,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b01111111,0b00000000,
    0b10000000,0b10000000,
    0b10000000,0b00000000,
    0b10000000,0b00000000,
    0b10000000,0b10000000,
    0b01111111,0b00000000,

    // d
    9,8,
    0b00000000,0b10000000,
    0b00000000,0b10000000,
    0b01111111,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b01111111,0b10000000,

    // e
    9,8,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b01111111,0b00000000,
    0b10000000,0b10000000,
    0b11111111,0b10000000,
    0b10000000,0b00000000,
    0b10000000,0b10000000,
    0b01111111,0b00000000,

    // s
    9,8,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b01111111,0b00000000,
    0b10000000,0b10000000,
    0b11111111,0b00000000,
    0b00000001,0b10000000,
    0b10000000,0b10000000,
    0b01111111,0b00000000,

    // g
    9,11,
    0b00000000,0b00000000,
    0b00000000,0b00000000,
    0b01111111,0b00000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b10000000,0b10000000,
    0b01111111,0b10000000,
    0b00000000,0b10000000,
    0b11000001,0b10000000,
    0b01111111,0b00000000


    };

    RGBmatrixPanel matrix(A0, A1, A2, CLK, LAT, OE, false);
    uint16_t black = matrix.Color444(0, 0, 0);
    uint16_t yellow = matrix.Color444(15, 15, 0);
    uint16_t darkyellow = matrix.Color444(1, 1, 0);
    uint16_t red = matrix.Color444(15, 0, 0);
    uint16_t white = matrix.Color444(15, 15, 15);
    uint16_t pink = matrix.Color444(15, 3, 15);
    uint16_t palePink = matrix.Color444(15, 8, 15);
    uint16_t blue = matrix.Color444(0, 0, 10);
    uint16_t cyan = matrix.Color444(0, 15, 15);
    uint16_t orange = matrix.Color444(15, 5, 0);
    uint16_t darkOrange = matrix.Color444(15, 1, 0);
    uint16_t green = matrix.Color444(0, 15, 0);


    int direction = 1;
    int ghostDirection = 1;
    int currentPacmanBitmap = 0;
    int currentGhostBitmap = 0;
    int biteDirection = 1; //opening or closing
    int pacmanX = PACMAN_START;
    int ghost1X = GHOST_START;
    int ghost2X = GHOST_START;
    int ghost3X = GHOST_START;
    int ghost4X = GHOST_START;
    int dotsY = 8;
    unsigned long loopCounter = 0;
    boolean didChange = false;
    boolean caught = false;
    uint16_t pillColor = palePink;
    const unsigned char *letterBitmaps[] = {(letter_bitmaps), (letter_bitmaps+18), (letter_bitmaps+36), (letter_bitmaps+54), (letter_bitmaps+72), (letter_bitmaps+94), (letter_bitmaps+104), (letter_bitmaps+122), (letter_bitmaps+140), (letter_bitmaps+158), (letter_bitmaps+176)};


    void setup() {
    matrix.begin();
    }

    void drawPacMan(int x, int y) {
    const unsigned char *bitmapBase = PACMAN_BITMAP;
    if (direction < 0) {
    bitmapBase = PACMAN_LEFT_BITMAP;
    }
    drawBitmap(x, y, bitmapBase+(currentPacmanBitmap*SIZEOF_BITMAP), yellow);
    drawBitmap(x, y, bitmapBase+((currentPacmanBitmap+3)*SIZEOF_BITMAP), darkyellow);
    }

    void animatePacMan() {
    currentPacmanBitmap += biteDirection;
    if (currentPacmanBitmap < 0) {
    biteDirection = -biteDirection;
    currentPacmanBitmap = 1;
    }
    if (currentPacmanBitmap > 2) {
    biteDirection = -biteDirection;
    currentPacmanBitmap = 1;
    }
    }

    void drawDeadGhost(int x, int y) {
    drawBitmap(x, y, GHOST_BITMAP+(currentGhostBitmap*SIZEOF_BITMAP), blue);
    drawBitmap(x, y, GHOST_FACE, pink);
    }

    void drawGhost(int x, int y, uint16_t color, int direction) {
    drawBitmap(x, y, GHOST_BITMAP+(currentGhostBitmap*SIZEOF_BITMAP), color);
    if (direction > 0) {
    drawBitmap(x, y, GHOST_EYES, white);
    matrix.drawPixel(x+5, y+4, blue);
    matrix.drawPixel(x+9, y+4, blue);
    } else {
    drawBitmap(x-2, y, GHOST_EYES, white);
    matrix.drawPixel(x+3, y+4, blue);
    matrix.drawPixel(x+6, y+4, blue);
    }
    }

    void animateGhost() {
    if (currentGhostBitmap == 0) {
    currentGhostBitmap++;
    } else {
    currentGhostBitmap--;
    }
    }


    void loop() {

    pacmanGameDemo();
    clear();
    matrix.swapBuffers(false);
    delay(1000);

    nootropicDesign();
    clear();
    matrix.swapBuffers(false);
    delay(500);

    invaderDemo();
    clear();
    matrix.swapBuffers(false);
    delay(1000);

    nootropicDesign();
    clear();
    matrix.swapBuffers(false);
    delay(500);

    pacmanCharacters();
    clear();
    matrix.swapBuffers(false);
    delay(1000);

    nootropicDesign();
    clear();
    matrix.swapBuffers(false);
    delay(500);


    }

    void invaderDemo() {
    int d = 70;
    int toggleCounter = 0;
    for(int y=-5;y<1;y++) {
    for(int x=-10;x<10;x++) {
    drawInvaders(x, y, toggleCounter%2);
    toggleCounter++;
    delay(d);
    }
    d -= 3;
    y++;
    for(int x=10;x>-10;x--) {
    drawInvaders(x, y, toggleCounter%2);
    toggleCounter++;
    delay(d);
    }
    d -= 3;
    }
    }


    void drawInvaders(int x, int y, int offset) {
    clear();
    for(int i=0;i<3;i++) {
    drawBitmap(x+(i*12), y, INVADER0_BITMAP+(SIZEOF_INVADER_BITMAP * offset), green);
    }
    for(int i=0;i<3;i++) {
    drawBitmap(x+(i*12), y+9, INVADER1_BITMAP+(SIZEOF_INVADER_BITMAP * offset), green);
    }
    for(int i=0;i<3;i++) {
    drawBitmap(x+(i*12), y+18, INVADER2_BITMAP+(SIZEOF_INVADER_BITMAP * offset), green);
    }
    matrix.swapBuffers(false);
    }


    void nootropicDesign() {
    int y = 1;
    int offset = 0;
    for(int x=32;x>-140;x--) {
    offset = 0;
    clear();
    offset += drawBitmap(x+offset, y, letterBitmaps[N], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[O], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[O], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[T], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[R], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[O], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[P], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps, darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[C], darkOrange) + 1;
    offset += 3;
    offset += drawBitmap(x+offset, y, letterBitmaps[D], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[E], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps, darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps, darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[G], darkOrange) + 1;
    offset += drawBitmap(x+offset, y, letterBitmaps[N], darkOrange) + 1;
    matrix.swapBuffers(false);
    delay(15);
    }
    }


    void pacmanCharacters() {
    pacmanX = PACMAN_START;
    int ghostStart = -40;
    ghost1X = ghostStart;
    ghost2X = ghostStart-13;
    ghost3X = ghostStart-26;
    ghost4X = ghostStart-39;
    direction = 1;
    ghostDirection = 1;
    loopCounter = 0;
    int d = 15;
    while (ghost4X < 45) {
    loopCounter++;
    if ((loopCounter % 2) == 0) {
    animatePacMan();
    }

    if ((loopCounter % 4) == 0) {
    animateGhost();
    }

    pacmanX += direction;
    ghost1X += ghostDirection;
    ghost2X += ghostDirection;
    ghost3X += ghostDirection;
    ghost4X += ghostDirection;

    clear();
    drawPacMan(pacmanX, Y);
    drawGhost(ghost1X, Y, red, ghostDirection);
    drawGhost(ghost2X, Y, cyan, ghostDirection);
    drawGhost(ghost3X, Y, pink, ghostDirection);
    drawGhost(ghost4X, Y, orange, ghostDirection);
    matrix.swapBuffers(false);
    delay(d);
    }

    delay(500);

    ghostStart = 32;
    ghost1X = ghostStart;
    ghost2X = ghostStart+13;
    ghost3X = ghostStart+26;
    ghost4X = ghostStart+39;
    pacmanX = ghostStart+64;
    direction = -1;
    ghostDirection = -1;
    loopCounter = 0;

    while (pacmanX > PACMAN_START) {
    loopCounter++;
    if ((loopCounter % 2) == 0) {
    animatePacMan();
    }

    if ((loopCounter % 4) == 0) {
    animateGhost();
    }

    pacmanX += direction;
    ghost1X += ghostDirection;
    ghost2X += ghostDirection;
    ghost3X += ghostDirection;
    ghost4X += ghostDirection;

    clear();
    drawPacMan(pacmanX, Y);
    drawDeadGhost(ghost1X, Y);
    drawDeadGhost(ghost2X, Y);
    drawDeadGhost(ghost3X, Y);
    drawDeadGhost(ghost4X, Y);
    matrix.swapBuffers(false);
    delay(d);
    }
    }

    void pacmanGameDemo() {
    ghost1X = GHOST_START;
    pacmanX = PACMAN_START;
    ghostDirection = 1;
    direction = 1;
    caught = false;
    loopCounter = 0;
    int d = 15;
    while (true) {
    loopCounter++;

    int mod;
    if (direction > 0) {
    mod = 2;
    } else {
    mod = 2;
    }
    if ((loopCounter % mod) == 0) {
    animatePacMan();
    }

    if ((loopCounter % 5) == 0) {
    animateGhost();
    }

    // move
    if (direction > 0) {
    mod = 3;
    } else {
    mod = 3;
    }
    if ((loopCounter % mod) == 0) {
    pacmanX += direction;
    }


    if (ghostDirection > 0) {
    mod = 2;
    } else {
    mod = 4;
    }
    if ((loopCounter % mod) == 0) {
    ghost1X += ghostDirection;
    }


    if (pacmanX >= 18) {
    ghostDirection = -1;
    }
    if (pacmanX >= 19) {
    direction = -1;
    }
    if ((!caught) && (direction < 0) && (ghost1X == -4)) {
    caught = true;
    clear();
    drawMaze();
    drawDots();
    drawBitmap(2, Y, SCORE, cyan);
    matrix.swapBuffers(false);
    delay(700);
    }
    if (pacmanX < PACMAN_START) {
    return;
    }


    clear();
    drawMaze();
    drawDots();
    drawPacMan(pacmanX, Y);
    if (!caught) {
    if (ghostDirection > 0) {
    drawGhost(ghost1X, Y, red, ghostDirection);
    } else {
    drawDeadGhost(ghost1X, Y);
    }

    }
    matrix.swapBuffers(false);
    delay(d);
    }
    }

    void drawDots() {
    int x, y;
    if ((loopCounter % 5) == 0) {
    if ((loopCounter % 10) == 0) {
    pillColor = palePink;
    } else {
    pillColor = black;
    }
    }

    if ((direction < 0) || (pacmanX >= 17)) {
    pillColor = black;
    }

    int pillX = 22;
    int pillY = 6;

    for(y=0;y<5;y++) {
    for(x=0;x<5;x++) {
    matrix.drawPixel(pillX+x, pillY+y, pillColor);
    }
    }
    matrix.drawPixel(pillX, pillY, black);
    matrix.drawPixel(pillX+4, pillY, black);
    matrix.drawPixel(pillX, pillY+4, black);
    matrix.drawPixel(pillX+4, pillY+4, black);


    for(x=1;x<21;x+=3) {
    if ((pacmanX+8 < x) && (direction > 0)) {
    matrix.drawPixel(x, 8, palePink);
    }
    }
    matrix.drawPixel(24, 0, palePink);
    matrix.drawPixel(24, 3, palePink);
    }

    void drawMaze() {
    int x, y;
    for(x=0;x<31;x++) {
    matrix.drawPixel(x, 15, blue);
    }
    for(x=0;x<18;x++) {
    matrix.drawPixel(x, 1, blue);
    }
    matrix.drawPixel(18, 0, blue);
    for(y=0;y<15;y++) {
    matrix.drawPixel(31, y, blue);
    }
    }

    void clear() {
    matrix.fillScreen(black);
    }

    uint8_t drawBitmap(int x, int y, const unsigned char *bmp, uint16_t color) {
    uint8_t width = pgm_read_byte(bmp);
    uint8_t height = pgm_read_byte(bmp+1);
    const unsigned char *p = bmp+2;
    uint8_t b;
    uint8_t bit;

    for (uint8_t j=0;j for (uint8_t i=0;i if ((i % 8) == 0) {
    b = pgm_read_byte(p);
    p++;
    bit = 7;
    }
    if ((b >> bit) & 0x1) {
    matrix.drawPixel(x+i, y+j, color);
    }
    bit--;
    }
    }
    return width;
    }
    #2320
    Michael
    Keymaster

    The MatrixDemo_v2 code is NOT for the 32×32 matrix. It is written for the 16×32 matrix. You can’t run it on the 32×32 matrix because there is not enough memory for this demo and to keep track of twice as many pixels.
    Use the 32×32 demos that come with the RGBmatrixPanel library, like plasma_32x32 and colorwheel_32x32. They will work.

    #2325
    MysticForce
    Member

    Hello Michael,
    Hopefully I will be able to test that out today. I have been stuck to my bed for last few days and I am hoping I will be able to get up and work on a few things today. Thanks for responding. I am handicap and right now having some trouble with my heart.

    -Dave

    #2326
    MysticForce
    Member

    Hello Michael,
    everything lights up but it isn’t working right. Here is the code I am using. Am I doing something wrong? Thanks for any help.

    -Dave

    // plasma demo for Adafruit RGBmatrixPanel library.
    // Demonstrates unbuffered animation on our 32x32 RGB LED matrix:
    // http://www.adafruit.com/products/607

    // Written by Limor Fried/Ladyada & Phil Burgess/PaintYourDragon
    // for Adafruit Industries.
    // BSD license, all text above must be included in any redistribution.

    #include // Core graphics library
    #include // Hardware-specific library
    #include

    // If your 32x32 matrix has the SINGLE HEADER input,
    // use this pinout:
    #define CLK 11 // MUST be on PORTB! (Use pin 11 on Mega)
    #define OE 9
    #define LAT 10
    #define A A0
    #define B A1
    #define C A2
    #define D A3
    // If your matrix has the DOUBLE HEADER input, use:
    //#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
    //#define LAT 9
    //#define OE 10
    //#define A A3
    //#define B A2
    //#define C A1
    //#define D A0
    RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false);

    static const int8_t PROGMEM sinetab[256] = {
    0, 2, 5, 8, 11, 15, 18, 21,
    24, 27, 30, 33, 36, 39, 42, 45,
    48, 51, 54, 56, 59, 62, 65, 67,
    70, 72, 75, 77, 80, 82, 85, 87,
    89, 91, 93, 96, 98, 100, 101, 103,
    105, 107, 108, 110, 111, 113, 114, 116,
    117, 118, 119, 120, 121, 122, 123, 123,
    124, 125, 125, 126, 126, 126, 126, 126,
    127, 126, 126, 126, 126, 126, 125, 125,
    124, 123, 123, 122, 121, 120, 119, 118,
    117, 116, 114, 113, 111, 110, 108, 107,
    105, 103, 101, 100, 98, 96, 93, 91,
    89, 87, 85, 82, 80, 77, 75, 72,
    70, 67, 65, 62, 59, 56, 54, 51,
    48, 45, 42, 39, 36, 33, 30, 27,
    24, 21, 18, 15, 11, 8, 5, 2,
    0, -3, -6, -9, -12, -16, -19, -22,
    -25, -28, -31, -34, -37, -40, -43, -46,
    -49, -52, -55, -57, -60, -63, -66, -68,
    -71, -73, -76, -78, -81, -83, -86, -88,
    -90, -92, -94, -97, -99,-101,-102,-104,
    -106,-108,-109,-111,-112,-114,-115,-117,
    -118,-119,-120,-121,-122,-123,-124,-124,
    -125,-126,-126,-127,-127,-127,-127,-127,
    -128,-127,-127,-127,-127,-127,-126,-126,
    -125,-124,-124,-123,-122,-121,-120,-119,
    -118,-117,-115,-114,-112,-111,-109,-108,
    -106,-104,-102,-101, -99, -97, -94, -92,
    -90, -88, -86, -83, -81, -78, -76, -73,
    -71, -68, -66, -63, -60, -57, -55, -52,
    -49, -46, -43, -40, -37, -34, -31, -28,
    -25, -22, -19, -16, -12, -9, -6, -3
    };

    void setup() {
    matrix.begin();
    }

    const float radius1 = 16.3, radius2 = 23.0, radius3 = 40.8, radius4 = 44.2,
    centerx1 = 16.1, centerx2 = 11.6, centerx3 = 23.4, centerx4 = 4.1,
    centery1 = 8.7, centery2 = 6.5, centery3 = 14.0, centery4 = -2.9;
    float angle1 = 0.0, angle2 = 0.0, angle3 = 0.0, angle4 = 0.0;
    long hueShift = 0;

    void loop() {
    int x1, x2, x3, x4, y1, y2, y3, y4, sx1, sx2, sx3, sx4;
    unsigned char x, y;
    long value;

    sx1 = (int)(cos(angle1) * radius1 + centerx1);
    sx2 = (int)(cos(angle2) * radius2 + centerx2);
    sx3 = (int)(cos(angle3) * radius3 + centerx3);
    sx4 = (int)(cos(angle4) * radius4 + centerx4);
    y1 = (int)(sin(angle1) * radius1 + centery1);
    y2 = (int)(sin(angle2) * radius2 + centery2);
    y3 = (int)(sin(angle3) * radius3 + centery3);
    y4 = (int)(sin(angle4) * radius4 + centery4);

    for(y=0; y x1 = sx1; x2 = sx2; x3 = sx3; x4 = sx4;
    for(x=0; x value = hueShift
    + (int8_t)pgm_read_byte(sinetab + (uint8_t)((x1 * x1 + y1 * y1) >> 2))
    + (int8_t)pgm_read_byte(sinetab + (uint8_t)((x2 * x2 + y2 * y2) >> 2))
    + (int8_t)pgm_read_byte(sinetab + (uint8_t)((x3 * x3 + y3 * y3) >> 3))
    + (int8_t)pgm_read_byte(sinetab + (uint8_t)((x4 * x4 + y4 * y4) >> 3));
    matrix.drawPixel(x, y, matrix.ColorHSV(value * 3, 255, 255, true));
    x1--; x2--; x3--; x4--;
    }
    y1--; y2--; y3--; y4--;
    }

    angle1 += 0.03;
    angle2 -= 0.07;
    angle3 += 0.13;
    angle4 -= 0.15;
    hueShift += 2;
    }
    #2327
    Michael
    Keymaster

    The CLK pin is pin 8, not 11.

    #define CLK 8
    #2330
    MysticForce
    Member

    Hello Micheal,
    I made that change and it does look like plasma, but now it is changing really slow like it is stuck on 1 frame per second. You can actually see the refresh rate. It is just not quite right. Is the other pins correct? Sorry to drive you crazy about this just want to see it working.

    -Dave

    #2331
    Michael
    Keymaster

    The refresh rate on that sketch is slow. Just use the plasma sketch that ships with the Adafruit library, without modification. That’s what works.

    #2332
    MysticForce
    Member

    Hello Michael,
    Please explain, I thought I was using the one from adafruit? There is another one or something? I am sorry for being slow. I am using a wrong plasma version? Can you please point me in the right direction? Also is there a paceman demo that does work on this v2 board?

    #2333
    Michael
    Keymaster

    I’m just saying to use the one from Adafruit without any modifications. You had changed the clock pin from 8 to 11 for some reason, and I don’t know if you changed other things. Just use the stock version of the sketch and it should work. Yes it is a bit slow.

    No there is no pacman demo for 32×32.

    #2334
    MysticForce
    Member

    Hello Michael,
    I changed it to 11 because I was using it on my mega. The code is all original and I hadn’t changed anything else, but that because it says to change to pin 11 if your using it with a mega board. That is how I know my 32×32 RGB Board works because I wired it up for use with my arduino mega 2560 board and the only change I made was that pin 11.

    -Dave

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.