Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Demo for new ring functions for garage detection unit by Chemdoc77
- #include "FastLED.h"
- #define NUM_LEDS 24
- #define Data_Pin 6
- #define chipset NEOPIXEL
- CRGB leds[NUM_LEDS];
- void setup() {
- delay(2000); // power-up safety delay
- FastLED.addLeds<chipset, Data_Pin>(leds, NUM_LEDS);
- FastLED.setBrightness(60);
- FastLED.setMaxPowerInVoltsAndMilliamps(5,450);
- set_max_power_indicator_LED(13);
- }
- //Predeclaration of functions
- void cd77_fill_part_ring(uint8_t numbertofill, CRGB color, uint8_t wait);
- void cd77_fill_ring(CRGB color, uint8_t wait);
- void loop() {
- cd77_fill_ring(CRGB::Green, 2000);
- FastLED.delay(1000);
- cd77_fill_part_ring(4, CRGB::Yellow, 200);
- FastLED.delay(500);
- cd77_fill_part_ring(8, CRGB::Yellow, 200);
- FastLED.delay(500);
- cd77_fill_part_ring(12, CRGB::Yellow,200);
- FastLED.delay(500);
- cd77_fill_ring(CRGB::Red, 5000);
- }
- //======================================
- void cd77_fill_part_ring(uint8_t numbertofill, CRGB color, int wait){ //Note: numbertofil must never be larger than NUM_LEDS/2
- for (uint8_t i = 1; i <numbertofill; i++){
- leds[(NUM_LEDS/2)-i ] = color;
- leds[(NUM_LEDS/2)+i ] = color;
- FastLED.show();
- FastLED.delay(wait);
- }
- FastLED.delay(wait*2);
- fill_solid( leds, NUM_LEDS, CRGB::Black);
- FastLED.show();
- }
- //==========================
- void cd77_fill_ring(CRGB color, int wait){
- fill_solid(leds, NUM_LEDS, color);
- FastLED.show();
- FastLED.delay(wait);
- fill_solid( leds, NUM_LEDS, CRGB::Black);
- FastLED.show();
- }
Add Comment
Please, Sign In to add comment