2 #include <FastLED_animation.h>
4 #include "BareButton.h"
6 //#include "animations/Adafruit.h"
7 //#include "animations/Debian.h"
8 //#include "animations/Firefox.h"
9 #include "animations/JMPrope.h"
10 //#include "animations/Openhardware.h"
11 //#include "animations/Opensource.h"
12 //#include "animations/S.S.C.Napoli.h"
13 //#include "animations/ao2.h"
14 //#include "animations/ao2it.h"
19 /* This is the same exposure time to set up on the camera */
20 #define EXPOSURE_TIME_MSEC 500UL
22 static struct CRGB leds[NUM_LEDS];
24 static BareButton button = BareButton(INPUT_PIN);
25 static unsigned long frame_delay_usecs = EXPOSURE_TIME_MSEC * 1000UL / NUM_FRAMES;
29 LEDS.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
34 unsigned long remaining;
35 unsigned long elapsed = 0;
37 if (button.isPressed()) {
38 unsigned long t0 = micros();
40 elapsed = micros() - t0;
42 for (int i = 0; i < NUM_LEDS; i++)
43 leds[i] = CRGB(0, 0, 0);
47 remaining = frame_delay_usecs - elapsed;
49 /* use leds to show how many _milliseconds_ we will have to wait to
50 * achieve a constant framerate */
51 for (unsigned int i = 0; i < NUM_LEDS; i++)
52 leds[i] = CRGB(0, 0, 0);
53 for (unsigned int i = 0; i < remaining / 1000; i++)
54 leds[i] = CRGB(255, 0, 0);
58 delayMicroseconds(remaining);