Created
February 1, 2023 15:10
-
-
Save hpwit/baf672c3659b99b165151ea04a5d8f3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define __HARDWARE_MAP | |
#include "I2SClocklessLedDriver.h" | |
#define ledsperstrip 256 | |
#define numstrips 16 | |
//here we have 3 colors per pixel | |
uint8_t leds[numstrips*ledsperstrip*3]; | |
#define LED_WIDTH 16 | |
uint16_t cal(int i) | |
{ | |
int d=i/LED_WIDTH; | |
int g=i%LED_WIDTH; | |
if(d%2==0) | |
{ | |
return d*LED_WIDTH+g; | |
} | |
else | |
{ | |
return (d+1)*LED_WIDTH-g-1; | |
} | |
} | |
int pins[16]={0,2,4,5,12,13,14,15,16,18,19,21,22,23,25,26}; | |
I2SClocklessLedDriver driver; | |
void setup() { | |
Serial.begin(115200); | |
driver.setMapLed(&cal); | |
driver.initled(leds,pins,numstrips,ledsperstrip,ORDER_GRB); | |
driver.setBrightness(10); | |
} | |
int off=0; | |
long time1,time2,time3; | |
void loop() { | |
memset(leds,0,numstrips*ledsperstrip*3); | |
time1=ESP.getCycleCount(); | |
for(int j=0;j<numstrips;j++) | |
{ | |
for(int i=0;i<(j+1)*2;i++) | |
{ | |
driver.setPixel((i+off)%ledsperstrip+ledsperstrip*j,255,0,0); | |
} | |
} | |
time2=ESP.getCycleCount(); | |
driver.showPixels(); | |
time3=ESP.getCycleCount(); | |
// Serial.printf("Calcul pixel fps:%.2f showPixels fps:%.2f Total fps:%.2f \n",(float)240000000/(time2-time1),(float)240000000/(time3-time2),(float)240000000/(time3-time1)); | |
off++; | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment