Skip to content

Instantly share code, notes, and snippets.

@hpwit
Last active October 12, 2021 17:43
Show Gist options
  • Select an option

  • Save hpwit/6cedb8c28ecaecc07a7bbcb531e3901c to your computer and use it in GitHub Desktop.

Select an option

Save hpwit/6cedb8c28ecaecc07a7bbcb531e3901c to your computer and use it in GitHub Desktop.
#include "FastLED.h"
#define NUM_LEDS_PER_STRIP 21
#define NUMSTRIPS 7
#define NUM_LEDS NUMSTRIPS * NUM_LEDS_PER_STRIP
#define CLOCK_PIN 18 //needs to be higher than 16
#include "I2SHD108.h"
int Pins[16]={23,22,21,19,5,4,2};
HD108Led leds[NUM_LEDS];
I2SHD108 controller(0);
HD108Led colors[NUMSTRIPS]={HD108Led(31,65000,0,0,0,0),HD108Led(0,0,31,65000,0,0),HD108Led(0,0,0,0,31,65000),HD108Led(31,65000,0,0,31,65000),HD108Led(0,0,31,65000,31,65000),HD108Led(31,65000,31,65000,0,0),HD108Led(31,65000,31,65000,31,65000)};
//you can create one HD108Led as such
/*
HD108Led pix=HD108Led(brightnessred,red,brightnessgreen,green ,brightnessblue,bleu);
*/
int offset=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
controller.initled((uint8_t*)leds,Pins,CLOCK_PIN,NUM_STRIPS,NUM_LEDS_PER_STRIP,HD108,1); //start with 1Mhz if it goes you can increase the speed
//controller.initled(leds,Pins,CLOCK_PIN,NUM_STRIPS,NUM_LEDS_PER_STRIP,freq in MHZ);
//controller.initled(leds,Pins,CLOCK_PIN,NUM_STRIPS,NUM_LEDS_PER_STRIP,2); //for 2MHZ
delay(200);
//set the brightness to max for all of the leds
for(int i=0;i<NUMSTRIPS;i++)
{
for (int j=0;j<NUM_LEDS_PER_STRIP;j++)
{
leds[NUM_LEDS_PER_STRIP*i+j]=colors[i]; //all colors will be red
}
}
controller.showPixels();
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment