Jingleby

FastLED Analog Strip Blend Test

Mar 2nd, 2016
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. //Main Goal: Analog Strip fades from one defined hue to a second defined hue
  2. //Secondary Goal: 4 analog strips repeating this action with each delayed slightly. (2 Variables to define delay amount and overall speed fade occurs)
  3.  
  4. #include "FastLED.h"
  5. #include "colorutils.h"
  6.  
  7. // fast led constants
  8. #define NUM_LEDS 1 // change to the number of LEDs in your strip
  9.  
  10. #define REDPIN 5
  11. #define GREENPIN 6
  12. #define BLUEPIN 3
  13.  
  14. // hold the values for led in your strip
  15. CRGB leds;
  16.  
  17. // blend variables
  18. fraction = 0.1 //steps? or speed of transition?
  19. CHSV color1 = CHSV(0, 255, 100);
  20. CHSV color2 = CHSV(180, 255, 100);
  21.  
  22. void showAnalogRGB( const CRGB& rgb)
  23. {
  24. analogWrite(REDPIN, rgb.r );
  25. analogWrite(GREENPIN, rgb.g );
  26. analogWrite(BLUEPIN, rgb.b );
  27. }
  28.  
  29.  
  30. void setup()
  31. {
  32. // not needed since analog strip?
  33. // FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
  34. }
  35.  
  36. void loop()
  37. {
  38. /*
  39. // Pixel blending
  40. // blend - computes a new color blended some fraction of the way
  41. // between two other colors.
  42. CRGB blend( const CRGB& p1, const CRGB& p2, fract8 amountOfP2 );
  43.  
  44. CHSV blend( const CHSV& p1, const CHSV& p2, fract8 amountOfP2,
  45. TGradientDirectionCode directionCode = SHORTEST_HUES );
  46. */
  47.  
  48. colorutils.blend(color1, color2, fraction, SHORTEST_HUES);
  49.  
  50. showAnalogRGB(CHSV(?, ?, ?));
  51.  
  52. delay(1000);
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment