Adafruit 32x32 matrix help

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() {



float g, f;

int incoming = 3;
//for testing, plan to use later

void loop() {

if (myserial.available() > 0) {
// read the incoming int:
// int incoming =;


//S1 (4,4)->(8,8)
for (int i = 4; i <= 8; i++) {
for (int k = 4; k <= 8; k++) {
float f=sin(incomingik);
matrix.drawPixel(i,k,matrix.Color333(if, kf, f*f));

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


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.