# General > IoT, IoE, and Maker Forum > Arduino Arduino UNO printing on 32*32 1/4 scan rate missy results.

## Joye

Hello Everyone,

I'm not sure if I'm posting in the right place 

I have asked about my problem many times everywhere and I couldnt have it solved yet.
For that I decided to make this topic for everyone who wants to share and challenge solving this problem.



To participate you will only  need:

One Arduino UNO.One LED Module or Panel (32x32 - ¼ Scan Rate)- *Dip Type is preferred.Download the RGB Matrix Panel library  and Adafruit GFX Library then put them in Arduino>libraries folder.Replace *RGBmatrixPanel.cpp* and *RGBmatrixPanel.h* with RGBmatrixPanel.cpp & RGBmatrixPanel.h._*(Modified files for 1/4 scan rate panels)_Some Jumper Wires.
Connect as follows:
CLK    To    8  
LAT    To   10
OE     To    9
A        To    A0
B        To    A1
C        To    A2 _*(I dont have it on my panel)_
D        To    A3 _*(I dont have it on my panel)_
R1       To   2
G1       To   3
B1       To   4
R2      To   5
G2      To   6
B2      To   7
GND   To   GND

_*My Panel Has only A & B Where C & D are grounded and not there._

Copy this code and paste it in new Arduino Sketch:


```
#include <gamma.h>
#include <RGBmatrixPanel.h>
#include <avr/pgmspace.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>



#define CLK 8  // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT 10
#define OE  9
#define A   A0
#define B   A1
#define C   A2
#define D   A3
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false, 2);


char inChar;                // Temp char storage
int num;
char tmpchr1;

uint64_t index = 0;
uint64_t index1 = 0;          
bool newPrint;
int r;
int g;
int b;

void setup() {
  pinMode(11,OUTPUT);
  pinMode(12,OUTPUT);
  Serial.begin(9600);
  digitalWrite(13, HIGH);
  matrix.begin();
  matrix.setTextSize(1);
  matrix.fillScreen(00);
  matrix.setTextColor(matrix.Color333(0,7,0));

  delay(100);
  matrix.print(00);
  digitalWrite(11, HIGH);
  digitalWrite(12, HIGH);
}


void loop() {
 
  // Check the availability of new input
    while(Serial.available())
    {

Loop1:
      num = Serial.parseInt();
      num = constrain(num, 0, 9999);
      Serial.print(num);

    if (num < 3)
        {
          goto Loop1;
          }

    if (num < 10)
    {
     if (num < 9)
        {
          r = 0;
          g = 7;
          b = 0;

          digitalWrite(11, HIGH);
          }     
     else
        {
          r = 7;
          g = 7;
          b = 0;
          digitalWrite(12, LOW);

          }
    }
     
     if (num > 10)
        { 
          r = 7;
          g = 0;
          b = 0;
          digitalWrite(11, LOW);

          }
          
        matrix.fillScreen(matrix.Color333(0, 0, 0));    // Delete the whole panel
        matrix.setCursor(0,0);                          // Set the top left position of the first line
        matrix.setTextColor(matrix.Color333(r,g,b));
        matrix.print(num);
        if (num < 3)
        {
          matrix.fillScreen(matrix.Color333(0, 0, 0));
          digitalWrite(12, LOW);
          delay(50);
          digitalWrite(12, HIGH);
          }
       
        newPrint = false;                               // New RGB print disabled

        delay(500);
        matrix.fillScreen(matrix.Color333(0, 0, 0));
          //digitalWrite(12, LOW);
         // delay(50);
          digitalWrite(11, HIGH);
    }
    index = 0;                              // Restart the storage of characters from 0
    index1 = 0;
    //
    delay(500);
    matrix.fillScreen(matrix.Color333(0, 0, 0));
 
          digitalWrite(11, HIGH);
}
```

Because my project is all about getting numbers from Serial Port, for that Im sending the numbers from the Arduino program directly from: Tools>Serial Monitor 

I just write some numbers on the Serial Monitor upper text box and make sure they look good on the display panel.

You can change font size from this line ( 1, 2 or 3 )



```
matrix.setTextSize(1);
```

Now lets see what happened with me:

Typing number 4 one time with font size 1: _(If not shown see attachment LED Panel1)_


Typing number 4 three times with font size 1: _(If not shown see attachment LED Panel2)_



Typing number 4 one time with font size 2: _(If not shown see attachment LED Panel3)_



Have fun trying the code with your panel if its ¼ Scan Rate 
And I think it will work fine if your panel is 16x32.

Please share your experience and surprise me if it works with your 32x32 Display Panel.

If you have the (32x32 ¼ scan rate Dip Type) one which has A & B pins and no C & D, 
You are more than welcome to solve this issue together, 

Thank you everyone

----------


## Joye

Here are the C++ files that modified by *Ruud* _(Many Thanx to him)_ to make Adafruit_GFX_Library compatible with 1/4 Scan Mood:
_*This modification worked fine with my 32*16 Dip type 1/4 LED Panel_ 




*RGBmatrixPanel.h*


```
#if ARDUINO >= 100
 #include "Arduino.h"
#else
 #include "WProgram.h"
 #include "pins_arduino.h"
#endif
#include "Adafruit_GFX.h"

class RGBmatrixPanel : public Adafruit_GFX {

 public:

  // Constructor for 16x32 panel:
  RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c,
    uint8_t sclk, uint8_t latch, uint8_t oe, boolean dbuf, uint8_t pwidth);
    /* Parameters
    a, b, c are the pins used for addressing the rows
    cclk, latch and oe are the pins used for Serial Clock, Latach and Output Enable
    dbuf enables double buffering. This will use 2x RAM for frame buffer, but will give nice smooth animation
    pwidth is the number of Panels used together in a multi panel configuration
    */

  // Constructor for 32x32 panel (adds 'd' pin): (THIS HAS NOT BEEN TESTED WITH MULTIPLE PANELS)
  RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c, uint8_t d,
    uint8_t sclk, uint8_t latch, uint8_t oe, boolean dbuf, uint8_t pwidth);

  void
    begin(void),
    drawPixel(int16_t x, int16_t y, uint16_t c),
    fillScreen(uint16_t c),
    updateDisplay(void),
    swapBuffers(boolean),
    dumpMatrix(void),
	getPtrAddress(void);
  uint8_t
    *backBuffer(void);
  uint16_t
    Color333(uint8_t r, uint8_t g, uint8_t b),
    Color444(uint8_t r, uint8_t g, uint8_t b),
    Color888(uint8_t r, uint8_t g, uint8_t b),
    Color888(uint8_t r, uint8_t g, uint8_t b, boolean gflag),
    ColorHSV(long hue, uint8_t sat, uint8_t val, boolean gflag);

  // Printing
 private:

  uint8_t *matrixbuff[2];
  uint8_t nRows, nPlanes, backindex, nPanels, nMultiplexRows, nCounter;
  boolean swapflag, written;
    
  // Init/alloc code common to both constructors:
  void init(uint8_t rows, uint8_t a, uint8_t b, uint8_t c,
    uint8_t sclk, uint8_t latch, uint8_t oe, boolean dbuf, uint8_t pwidth);

  // PORT register pointers, pin bitmasks, pin numbers:
  volatile uint8_t
    *latport, *oeport, *addraport, *addrbport, *addrcport, *addrdport;
  uint8_t
    sclkpin, latpin, oepin, addrapin, addrbpin, addrcpin, addrdpin,
    _sclk, _latch, _oe, _a, _b, _c, _d;

  // Counters/pointers for interrupt handler:
  volatile uint8_t row, plane;
  volatile uint8_t *buffptr;
};
```


In Attachment you can find the RGBmatrixPanel.cpp, Open with Visual Studio or you can view it with Notepad. _*It's too big to post the code here._

----------


## buzzuk61

16x32 1/4 Scan Rgb Led Panel Problem

Help me

----------

