|
123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
-
-
- #include "Tlc5940.h"
- #include "tlc_fades.h"
-
-
- #define ANALOG_PIN 0
-
-
- #define SCOPE_PERIOD (1000 * NUM_TLCS)
- #define LED_PERIOD SCOPE_PERIOD / (NUM_TLCS * 16)
-
- TLC_CHANNEL_TYPE channel;
-
- void setup()
- {
- Tlc.init();
- }
-
- void loop()
- {
- uint32_t lastMillis = millis();
- tlc_addFade(channel,
- analogRead(ANALOG_PIN) * 4,
- 0,
- lastMillis + 2,
- lastMillis + (uint16_t)SCOPE_PERIOD / 4
- );
- if (channel++ == NUM_TLCS * 16) {
- channel = 0;
- }
- uint32_t currentMillis;
- do {
- currentMillis = millis();
- tlc_updateFades(currentMillis);
- } while (currentMillis - lastMillis <= LED_PERIOD);
- }
-
|