Go Down

Topic: Adafruit 32x32 matrix help (Read 210 times) previous topic - next topic

hhager

I'm trying to import and integer from another device (a counter which counts up by 1/sec) and have the light displayed on a 32x32 matrix change in accordance with that integer. I have my hardware set up correctly (or at least correctly enough for the Adafruit example code to work), which leads me to believe that this is a programming issue. I've been staring at this code for a while now and I can't figure out where I'm going wrong. Everything compiles and uploads correctly. I have very little experience with Arduino (and basically none with LED matrices), so hopefully it's an easy fix for someone who knows what they're doing. Any help would be GREATLY appreciated. Thanks in advance!

here's the code:

#include <SoftwareSerial.h>
#include <RGBmatrixPanel.h>

const byte rxPin = 18;
const byte txPin = 19;

SoftwareSerial myserial(18, 19);
int incoming = 0;

#define CLK  8  
#define OE   9
#define LAT 10
#define A   A0
#define B   A1
#define C   A2
#define D   A3

RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false);

void setup() {

 myserial.begin(9600);

 matrix.begin();


 float g, f;

 int incoming = 3;
//for testing, plan to use myserial.read() later
}

void loop() {                            

 
 if (myserial.available() > 0) {
   // read the incoming int:
  // int incoming = myserial.read();
 
 }
 
  //S1 (4,4)->(8,8)
 for (int i = 4; i <= 8; i++) {
   for (int k = 4; k <= 8; k++) {
     float f=sin(incoming*i*k);
     matrix.drawPixel(i,k,matrix.Color333(i*f, k*f, f*f));
   }
 }

//S2 (22,22)->(27,27)
for (int i = 22; i <= 27; i++) {
   for (int k = 22; k <= 27; k++) {
     float g=sin(incoming*i*k);
     matrix.drawPixel(i,k,matrix.Color333(i*g, k*g, g*g));
   }
 }

}

PaulRB

You'll get a useful response much more quickly if you read the forum guide in the "please read" sticky post before you post your question.

Go Up