32x32 LED Matrix Display Help

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Phizy
 
Posts: 2
Joined: Mon Apr 16, 2018 4:43 pm

32x32 LED Matrix Display Help

Post by Phizy »

Hey everyone I wired up my arduino mega to my 32x32 LED Matrix and when I run the color wheel test code I get this image on my matrix, is this wiring bad or is something else going on here? the only thing I can think of to cause this is maybe my code is not uploading properly when I have to switch from CLK 8 to CLK 11? Any help or input would be appreciated!

Here is the panel when it is powered on and the code is uploaded:
https://imgur.com/a/TXgP0E8

Here is the code:

Code: Select all

// colorwheel demo for Adafruit RGBmatrixPanel library.
// Renders a nice circle of hues 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 <Adafruit_GFX.h>   // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library

// If your 32x32 matrix has the SINGLE HEADER input,
// use this pinout:
//#define CLK 8  // 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 11  // 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);

void setup() {
  int      x, y, hue;
  float    dx, dy, d;
  uint8_t  sat, val;
  uint16_t c;

  matrix.begin();

  for(y=0; y < matrix.width(); y++) {
    dy = 15.5 - (float)y;
    for(x=0; x < matrix.height(); x++) {
      dx = 15.5 - (float)x;
      d  = dx * dx + dy * dy;
      if(d <= (16.5 * 16.5)) { // Inside the circle(ish)?
        hue = (int)((atan2(-dy, dx) + PI) * 1536.0 / (PI * 2.0));
        d = sqrt(d);
        if(d > 15.5) {
          // Do a little pseudo anti-aliasing along perimeter
          sat = 255;
          val = (int)((1.0 - (d - 15.5)) * 255.0 + 0.5);
        } else
        {
          // White at center
          sat = (int)(d / 15.5 * 255.0 + 0.5);
          val = 255;
        }
        c = matrix.ColorHSV(hue, sat, val, true);
      } else {
        c = 0;
      }
      matrix.drawPixel(x, y, c);
    }
  }
}

void loop() {
  // do nothing
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”