Created
December 9, 2021 16:07
-
-
Save hpwit/cb01c76b6d8f025fa9f23a3a54a51fa1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 NBIS2SERIALPINS 7 //the number of virtual pins here mavimum 32 strips | |
| #define STATIC_COLOR_GRB 1 //set the strip color | |
| #define NUM_LEDS_PER_STRIP 120 | |
| #define NUM_LEDS (NUM_LEDS_PER_STRIP*NBIS2SERIALPINS*8) | |
| #define CLOCK_PIN 16 | |
| #define LATCH_PIN 26 | |
| #define NUM_STRIPS 56 | |
| #define CONFIG_FREERTOS_USE_TRACE_FACILITY 1 | |
| #define CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS 1 | |
| #include "freertos/task.h" | |
| #include <ArtnetESP32.h> | |
| #include "I2SClocklessVirtualLedDriver.h" | |
| //here we have 3 colors per pixel | |
| uint8_t leds[NUM_STRIPS*NUM_LEDS_PER_STRIP*3]; | |
| #define UNIVERSE_SIZE 170 | |
| int pins[16]={12,13,14,15,5,4,2}; | |
| #define FRAMECNT 400 | |
| ArtnetESP32 artnet; | |
| I2SClocklessVirtualLedDriver driver; | |
| volatile long time1,time2; | |
| void displayfunction() | |
| { | |
| if (artnet.frameslues%FRAMECNT==0) | |
| { | |
| time2=millis(); | |
| Serial.printf("nb frames read: %d nb of incomplete frames:%d lost:%.2f%% fps:%.2f \n",artnet.frameslues,artnet.lostframes,(float)(artnet.lostframes*100)/(artnet.frameslues+artnet.lostframes),(float)FRAMECNT*1000/(time2-time1)); | |
| time1=time2; | |
| } | |
| //here the buffer is the led array hence a simple FastLED.show() is enough to display the array | |
| //FastLED.show(); | |
| } | |
| void setup() { | |
| Serial.begin(115200); | |
| Serial.begin(115200); | |
| WiFi.mode(WIFI_STA); | |
| Serial.printf("Connecting "); | |
| WiFi.begin("", ""); | |
| while (WiFi.status() != WL_CONNECTED) { | |
| Serial.println(WiFi.status()); | |
| delay(500); | |
| Serial.print("."); | |
| } | |
| Serial.println(""); | |
| Serial.println("WiFi connected."); | |
| Serial.println("IP address: "); | |
| Serial.println(WiFi.localIP()); | |
| driver.initled((uint8_t*)leds,pins,CLOCK_PIN,LATCH_PIN); | |
| driver.setBrightness(10); | |
| artnet.setFrameCallback(&displayfunction); //set the function that will be called back a frame has been received | |
| artnet.setLedsBuffer((uint8_t*)leds); //set the buffer to put the frame once a frame has been received | |
| artnet.begin(NUM_LEDS,UNIVERSE_SIZE,0); //configure artnet | |
| time1=millis(); | |
| } | |
| int off=0; | |
| void loop() { | |
| artnet.readFrame(); //ask to read a full frame | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment