#include <Arduino.h>
#include "FastLED.h"
byte brightness = 255; // яркость LED светодиодов
byte baza = 0; // изменение оттенка LED
#define NUM_LEDS 48
#define PIN_LEDS 11
CRGB leds[NUM_LEDS] = {0};
#include "bounce.h"
BouncingBallEffect balls;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
pinMode(PIN_LEDS, OUTPUT);
Serial.begin(115200);
while (!Serial) {}
Serial.println("Module Startup.");
FastLED.addLeds <NEOPIXEL, PIN_LEDS>(leds, NUM_LEDS);//.setCorrection(TypicalLEDStrip);
FastLED.setBrightness(brightness);
FastLED.clear();
FastLED.show();
//FastLED.setMaxPowerInMilliWatts(150);
}
void loop() {
bool bLED = false;
//double fps = 0;
//double dStart = double(millis())/1000.0;
while (true)
{
balls.Draw();
//uint32_t milliwats = calculate_unscaled_power_mW(leds, NUM_LEDS); //какую мощность мы выдаем
static unsigned long msLastUpdate = millis();
if (millis() - msLastUpdate > 1000)
{
//Serial.print("Power: ");
//Serial.println(milliwats);
bLED = !bLED;
digitalWrite(LED_BUILTIN, bLED);
msLastUpdate = millis();
}
}
/*
for (int i = 0; i < NUM_LEDS; i++) {
leds[i].nscale8(250);
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV(baza++, 255, 255);
FastLED.setBrightness(bright);
FastLED.show();
delay(20);
}
*/
}