dcsimg
Results 1 to 2 of 2

Thread: Arduino UNO printing on 32*32 1/4 scan rate missy results.

  1. #1

    Thread Starter
    Addicted Member Joye's Avatar
    Join Date
    Jul 2009
    Posts
    206

    Arduino UNO printing on 32*32 1/4 scan rate missy results.

    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:


    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:
    Code:
    #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 )

    Code:
    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)
    Name:  image1(1).jpeg
Views: 513
Size:  174.3 KB

    Typing number 4 three times with font size 1: (If not shown see attachment LED Panel2)
    Name:  image2(1).jpeg
Views: 503
Size:  180.9 KB


    Typing number 4 one time with font size 2: (If not shown see attachment LED Panel3)
    Name:  image3(1).jpeg
Views: 502
Size:  101.2 KB


    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

  2. #2

    Thread Starter
    Addicted Member Joye's Avatar
    Join Date
    Jul 2009
    Posts
    206

    Re: Arduino UNO printing on 32*32 1/4 scan rate missy results.

    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
    Code:
    #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.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width