Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixel-wise brightness #19

Closed
letalvoj opened this issue Jan 23, 2023 · 3 comments
Closed

Pixel-wise brightness #19

letalvoj opened this issue Jan 23, 2023 · 3 comments

Comments

@letalvoj
Copy link

One of the original modes (the Matrix rain like falling stripes) has two different tones. The bottom most dot is more bright than the rest of the stripe.

Screenshot 2023-01-23 at 22 09 52

@ph1p have you mentioned that? It be nice to control the brightness.

@mlemarrec
Copy link

Hello,
There is no way to change the brightness of only one pixel.
Ikea play with the retinal persistence.

Here a code to do it with an other library:
https://github.com/mlemarrec/ObegransadPanel

  int8_t* rainBuf = (int8_t*) malloc(16 * sizeof(int8_t));
  bool raintInit = false;
  
  void rain() {
  
    if( !raintInit ) {
      for( uint8_t x = 0; x<16; x++) {
        rainBuf[x] = random( -64, -1);
      }
      raintInit = true;
    }
  
    // 8 loop for retina persistence
    for( uint8_t i = 0; i<8; i++) {
      panel.clear();
      analogWrite(PIN_ENABLE, 192);delay(1);
      for( int8_t x = 15; x >= 0; x-- ){
        for( int8_t y = 4; y >= 0; y-- ){
          panel.drawPixel( x, rainBuf[x]+y, 1);
        }
      }
      panel.scan();
      delay(2);
  
      panel.clear();
      analogWrite(PIN_ENABLE, 0);delay(1);
      for( int8_t x = 15; x >= 0; x-- ){
        panel.drawPixel( x, rainBuf[x]+4, 1);
      }
      panel.scan(); 
      delay(8);
    }  
  
    for( uint8_t x=0; x<16; x++){
        if( rainBuf[x] < 16) { rainBuf[x]++; }
        else { rainBuf[x] = random( -64, -1);}
    }
  
  }

@mlemarrec
Copy link

And here an other code (k2000 effect) with 3 brightess and retina persistance:

int8_t k2000x = 3;
int8_t k2000d = 1;

void k2000() {

  uint8_t xmin = 3;
  uint8_t xmax = 15 - xmin;

  uint8_t ymin = 7;
  uint8_t ymax = 15 - ymin -1;

  // loop for retinal persistence
  for( uint8_t i = 0; i< 10; i++) {
    
    panel.clear();
    analogWrite(PIN_ENABLE, 192);delay(1);
    
    for( int8_t y = ymin; y <= ymax; y++ ){
      for( int8_t x = xmin; x <= xmax; x++ ){
        if( x >= k2000x - 2 && x <= k2000x + 2 ) {
          panel.drawPixel( x, y, 1);
        }        
      }
    }
    panel.scan();
    delay(2);

    panel.clear();
    analogWrite(PIN_ENABLE, 96);delay(1);
    for( int8_t y = ymin; y <= ymax; y++ ){  
      if( k2000x - 1 >= xmin) { panel.drawPixel( k2000x-1, y, 1); }
      panel.drawPixel( k2000x, y, 1);
      if( k2000x + 1 <= xmax) { panel.drawPixel( k2000x+1, y, 1); }

    }
    panel.scan(); 
    delay(4);

    panel.clear();
    analogWrite(PIN_ENABLE, 0);delay(1);
    for( int8_t y = ymin; y <= ymax; y++ ){  
      panel.drawPixel( k2000x, y, 1);
    }
    panel.scan(); 
    delay(6);    
  }  

  if( k2000d == 1) { k2000x++; }
  else { k2000x--; }

  if( k2000x == xmin) { k2000d = 1; }
  if( k2000x == xmax) { k2000d = 0; }

}

@ph1p
Copy link
Owner

ph1p commented Jul 5, 2023

Now possible :)

@ph1p ph1p closed this as completed Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants