Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ========== Animations ==========
- // First animation
- const long ledarray0[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- };
- const long ledarray1[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- };
- const long ledarray2[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- };
- const long ledarray3[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- };
- const long ledarray4[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00808000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- };
- const long ledarray5[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00228000, 0x00000000, 0x00228000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00808000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00228000, 0x00000000, 0x00228000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- };
- const long ledarray6[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00228000, 0x00000000, 0x00000000, 0x00000000, 0x00228000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00228000, 0x00000000, 0x00228000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00228000, 0x00000000, 0x00228000, 0x00000000, 0x00000000,
- 0x00000000, 0x00228000, 0x00000000, 0x00000000, 0x00000000, 0x00228000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- };
- const long ledarray7[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00228000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00228000,
- 0x00000000, 0x00228000, 0x00000000, 0x00000000, 0x00000000, 0x00228000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00228000, 0x00000000, 0x00000000, 0x00000000, 0x00228000, 0x00000000, 0x00000000,
- 0x00000000, 0x00228000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00228000,
- };
- const long ledarray8[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00228000,
- 0x00000000, 0x00228000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00228000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00228000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00228000,
- };
- const long ledarray9[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00228000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- };
- const long ledarray10[] PROGMEM = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- };
- // Second animation
- // Third animation
- // =======================
- // FastLED
- #include "FastLED.h"
- #define LED_TYPE NEOPIXEL
- #define DATA_PIN A3
- #define MASTER_BRIGHTNESS 255
- #define MATRIX_HEIGHT 8
- #define MATRIX_WIDTH 8
- #define NUM_LEDS MATRIX_HEIGHT*MATRIX_WIDTH
- CRGB leds[NUM_LEDS];
- const int __NUM_LEDS = 64; // per frame
- const unsigned long __DELAY_MS = 80; // controls speed of animations
- uint8_t hue = 96; // Hue color (0-255) 255 - red, 96 - green,
- // const byte off = 0; // brightness values
- const byte low = 85;
- const byte med = 155;
- const byte high = 255;
- #include <EdgeDebounce.h>
- const int button1_pin = 10;
- const int button2_pin = 12;
- const int button3_pin = A0;
- EdgeDebounce button1(button1_pin, PULLUP);
- EdgeDebounce button2(button2_pin, PULLUP);
- EdgeDebounce button3(button3_pin, PULLUP);
- int launchMode = 0;
- void setup() {
- FastLED.addLeds<LED_TYPE, DATA_PIN>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
- FastLED.setBrightness(MASTER_BRIGHTNESS);
- button1.begin();
- button2.begin();
- button3.begin();
- }
- void loop() {
- checkButtons();
- ButtonLaunch();
- }
- void ButtonLaunch() {
- switch (launchMode) {
- case 0: allOff(); break;
- case 1: launchSmall(); break;
- case 2: launchMedium(); break;
- case 3: launchLarge(); break;
- }
- }
- void launchSmall() {
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray0[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray1[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray2[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray3[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray4[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray5[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray6[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray7[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray8[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray9[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- FastLED.clear();
- for(int i = 0; i < __NUM_LEDS; i++)
- {
- leds[i] = pgm_read_dword(&(ledarray10[i]));
- }
- FastLED.show();
- delay(__DELAY_MS);
- }
- void launchMedium() {
- }
- void launchLarge() {
- }
- // upgrade this function to take hue as well as brightness
- void allOff(){
- for (int i = 0; i < NUM_LEDS; ++i) {
- leds[i] = CRGB::Black;
- FastLED.show();
- }
- }
- void checkButtons() {
- // Set buttonMode based on which button is pressed. HIGH is open, LOW is pressed.
- if (button1.rose()) {
- launchMode = 1;
- } else if (button2.rose()) {
- launchMode = 2;
- } else if (button3.rose()) {
- launchMode = 3;
- } else {
- launchMode = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement