Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define NUM_LEDS 50
- #define DATA_PIN 6
- //Fire
- #define BRIGHTNESS 200
- #define FRAMES_PER_SECOND 60
- #define COOLING 55
- #define SPARKING 120
- CRGB leds[NUM_LEDS];
- int val;
- //Fire
- bool gReverseDirection = false;
- bool isStrobeWhiteOn = false;
- bool isFireOn = false;
- //-----------------------------------Setup-----------------------------------
- void setup()
- {
- Serial.begin(115200); // set serial speed
- FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
- FastLED.setBrightness( BRIGHTNESS );
- }
- //-------------------------------------Loop-------------------------------------
- void loop()
- {
- if (Serial.available() == 0);
- val = Serial.parseInt(); // deduct ascii value of '0' to find numeric value of sent number
- {
- if (val == 1 )
- {
- fill_solid( leds, NUM_LEDS, CRGB::Red);
- FastLED.show();
- }
- /////////
- if (val == 2)
- {
- fill_solid( leds, NUM_LEDS, CRGB::Yellow);
- FastLED.show();
- }
- /////////
- {
- if (val == 3 )
- fill_solid( leds, NUM_LEDS, CRGB::Green);
- FastLED.show();
- }
- if (val == 4 )
- {
- fill_solid( leds, NUM_LEDS, CRGB::Orange);
- FastLED.show();
- }
- /////////
- if (val == 5 )
- {
- fill_solid( leds, NUM_LEDS, CRGB::Purple);
- FastLED.show();
- }
- /////////
- if (val == 6 )
- {
- fill_solid( leds, NUM_LEDS, CRGB::Blue);
- FastLED.show();
- }
- /////////
- if (val == 7 )
- {
- fill_solid( leds, NUM_LEDS, CRGB::Cyan);
- FastLED.show();
- }
- /////////
- if (val == 8 )
- {
- isStrobeWhiteOn = true;
- }
- /////////
- if (val == 9 )
- {
- isFireOn = true;
- }
- Serial.println(val);
- }
- if (isStrobeWhiteOn)
- {
- StrobeWhite();
- }
- if (isFireOn)
- {
- Fire2012();
- FastLED.show(); // display this frame
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement