Advertisement
Guest User

Untitled

a guest
Jun 26th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.44 KB | None | 0 0
  1. #include <FastSPI_LED.h>
  2. #include <SD.h>
  3. #include <Wire.h>
  4. //#include <Adafruit_GFX.h>
  5. //#include <Adafruit_SSD1306.h>
  6. int color[3];
  7. // *** LED stuff
  8. struct CRGB {
  9.   unsigned char g;
  10.   unsigned char r;
  11.   unsigned char b;
  12. };
  13. #define NUM_LEDS 42 //42 in the middle I think?
  14. // pin that the WS2811 strip is attached to on the arduino
  15. #define PIN 4 // for D5... oh arduino...
  16. struct CRGB *leds;
  17. int idx_offset = 0;  //  ** included because I am lazy! OFFSET INDEX (BOTTOM LED TO ZERO WHEN LOOP IS TURNED/DOESN'T REALLY WORK)
  18.  
  19. int hue=0;
  20. int ledNum=0;
  21. int upDown = 1;
  22.  
  23. void setup()
  24. {
  25.  
  26.   // *** WS2811 setup
  27.   FastSPI_LED.setLeds(NUM_LEDS);
  28.   FastSPI_LED.setChipset(CFastSPI_LED::SPI_TM1809); // seriously amazes me this works
  29.   FastSPI_LED.setPin(PIN);
  30.   FastSPI_LED.setDataRate(7);      //-IF LEDS FLICKER, PLAY WITH THIS (0-7)
  31.   FastSPI_LED.init();
  32.   FastSPI_LED.start();
  33.   leds = (struct CRGB*)FastSPI_LED.getRGBData(); // I think this marries the leds struct to wtf ever fastSPI is doing. I suck at C.
  34.  
  35.   // *** AND GO!
  36.   Serial.begin(56700);
  37.   Serial.println("HELLO!!!");
  38.  
  39.  
  40.   // begin staff bootup seq
  41.  
  42.   one_color_all(127,0,0); //RGB order. color test B
  43.   delay(250);
  44.   one_color_all(0,127,0); //RGB order. color test G
  45.   delay(250);
  46.   one_color_all(0,0,127); //RGB order. color test R
  47.   delay(250);
  48.   //one_color_all(255,255,255); // max power test (all on white)
  49.   //delay(500);
  50.   randomSeed(analogRead(A0));
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement