#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 24 //3 Inch
//#define NUM_LEDS 40 //2 Inch
//#define NUM_LEDS 20 //1 Inch
//Data and Clock Pins
#define DATA_PIN 2
#define CLOCK_PIN 17
// Define the array of leds
CRGB ring[NUM_LEDS];
uint8_t ringMap[255];
uint8_t rotation = 0;
float angleRangePerLED = 220.0 / NUM_LEDS; //A single LED will take up a space this many degrees wide.
void populateMap () { //we map LED's to a 360 degree circle where 360 == 255
for (int ledNum = 0; ledNum < NUM_LEDS; ledNum++) { //Loops through each LED and assigns it to it's range of angles
for (int j = round(ledNum * angleRangePerLED); j < round((ledNum + 1) * angleRangePerLED); j++){
ringMap[j] = ledNum;
}
}
}
void fadeAll(uint8_t scale = 250){
for (int i = 0; i < NUM_LEDS; i++){
ring[i].nscale8(scale);
}
}
void setup(){
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(ring, NUM_LEDS);
FastLED.setBrightness(132);
populateMap();
}
void loop(){
for (int i = 0; i < 2; i++){
uint8_t angle = round(i * 85.3333) + rotation;
ring[ringMap[angle]] = CHSV(angle, 127, 255);
}
FastLED.show();
rotation++;
fadeAll(245);
delay(5);
}
nano:12
nano:11
nano:10
nano:9
nano:8
nano:7
nano:6
nano:5
nano:4
nano:3
nano:2
nano:GND.2
nano:RESET.2
nano:0
nano:1
nano:13
nano:3.3V
nano:AREF
nano:A0
nano:A1
nano:A2
nano:A3
nano:A4
nano:A5
nano:A6
nano:A7
nano:5V
nano:RESET
nano:GND.1
nano:VIN
nano:12.2
nano:5V.2
nano:13.2
nano:11.2
nano:RESET.3
nano:GND.3
ring1:GND
ring1:VCC
ring1:DIN
ring1:DOUT