blinking while writing to screen on 32x64 matrix

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
seattleandrew
 
Posts: 27
Joined: Tue Feb 01, 2011 9:02 pm

blinking while writing to screen on 32x64 matrix

Post by seattleandrew »

Hi everyone. I'm attempting to do some animations using the 32x63 RGB LED matrix and I'm running into issues with the current library. My previous experience on LED matrices included the HT 1632 (16x24 red LED matrix) and the code for that display allowed me to draw many different shapes without redrawing the screen after each shape draw. On the 32x64 RGB LED panel, every time I draw a shape or clear the screen it has to redraw the entire display. Is there anyway to "draw" shapes without committing to write the screen after every line of code? Is this just a limitation of the board?

Edit: you can see the "stuttery" effect when the eyes are closing since I have to wipe what was previously drawn in this video
https://www.youtube.com/watch?v=OwMKHxtECX0

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: blinking while writing to screen on 32x64 matrix

Post by adafruit_support_rick »

You should only have to redraw the screen after you complete a series of shapes. Please post your code

User avatar
seattleandrew
 
Posts: 27
Joined: Tue Feb 01, 2011 9:02 pm

Re: blinking while writing to screen on 32x64 matrix

Post by seattleandrew »

Code: Select all

void drawEyes(int type, int randTime){
  //randTime represents the delayed time between blinks to make it feel more natural
  int r = random(3);
  int g = random(3);
  int b = random(3);
  
  //if rgb are all blank, set red to 1
  if(r == 0 && g == 0 && b == 0){
    r = 1;
  }
  if(type == 0){
  //normal eyes
    matrix.fillCircle(17, 11, 7, matrix.Color333(r, g, b));
    matrix.fillCircle(17, 20, 7, matrix.Color333(r, g, b));
    matrix.fillRect(10, 14, 15, 4, matrix.Color333(r, g, b));
    matrix.fillCircle(45, 11, 7, matrix.Color333(r, g, b));
    matrix.fillCircle(45, 20, 7, matrix.Color333(r, g, b));
    matrix.fillRect(38, 14, 15, 4, matrix.Color333(r, g, b));
    //shiny parts of eyes
    matrix.fillRect(19, 8, 2, 2, matrix.Color333(0, 0, 0));
    matrix.fillRect(20, 12, 3, 4, matrix.Color333(0, 0, 0));
    matrix.drawPixel(22, 11, matrix.Color333(0, 0, 0));
    matrix.fillRect(47, 8, 2, 2, matrix.Color333(0, 0, 0));
    matrix.fillRect(48, 12, 3, 4, matrix.Color333(0, 0, 0));
    matrix.drawPixel(50, 11, matrix.Color333(0, 0, 0));
    delay(randTime); 
    clearScreen();
    
    //begin blink
    matrix.fillCircle(17, 14, 7, matrix.Color333(r, g, b));
    matrix.fillCircle(17, 17, 7, matrix.Color333(r, g, b));
    matrix.fillCircle(45, 14, 7, matrix.Color333(r, g, b));
    matrix.fillCircle(45, 17, 7, matrix.Color333(r, g, b));
    //shiny
    matrix.fillRect(19, 10, 2, 2, matrix.Color333(0, 0, 0));
    matrix.fillRect(20, 14, 3, 4, matrix.Color333(0, 0, 0));
    matrix.drawPixel(22, 13, matrix.Color333(0, 0, 0));
    matrix.fillRect(47, 10, 2, 2, matrix.Color333(0, 0, 0));
    matrix.fillRect(48, 14, 3, 4, matrix.Color333(0, 0, 0));
    matrix.drawPixel(50, 13, matrix.Color333(0, 0, 0));
This may be long and unnecessary but as soon as "//begin blink" happens, it gets a little jittery in how it draws to the screen. The method "ClearScreen()" is just a simple call to fillRect(0,0,width,height, none) since the fill method appears to be missing. Regardless of what I do to "erase" the screen and draw, it seems to get this laggy draw rate. Is it unnecessary for me to erase what I've already drawn to the screen?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: blinking while writing to screen on 32x64 matrix

Post by adafruit_support_rick »

Yeah, you don't want to do the clearScreen. You want to simply overwrite what's there. You'll have to erase small areas to get the drawing right, but you don't want to clear the whole screen. That's where the problem is coming from.

User avatar
seattleandrew
 
Posts: 27
Joined: Tue Feb 01, 2011 9:02 pm

Re: blinking while writing to screen on 32x64 matrix

Post by seattleandrew »

Good news!

Well, after some tough work, I managed to make the animations much smoother, if anyone is interested, I made sure to NEVER draw and then erase (and vice versa) an area before my delay. This caused all the blinking as the display was writing and then immediately erasing, causing some flickering to the animation.

Here's what it looks like now:
https://www.youtube.com/watch?v=FNfoAHi ... e=youtu.be

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

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”