Advertisement
Dkloss28

Untitled

Oct 22nd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. // NeoPixel Ring simple sketch (c) 2013 Shae Erisson
  2. // released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
  3.  
  4. #include <Adafruit_NeoPixel.h>
  5. #ifdef __AVR__
  6. #include <avr/power.h>
  7. #endif
  8.  
  9. // Which pin on the Arduino is connected to the NeoPixels?
  10. // On a Trinket or Gemma we suggest changing this to 1
  11. #define PIN 9
  12.  
  13. // How many NeoPixels are attached to the Arduino?
  14. #define NUMPIXELS 10
  15.  
  16. // When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
  17. // Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
  18. // example for more information on possible values.
  19. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);
  20.  
  21. int delayval = 500; // delay for half a second
  22.  
  23. void setup() {
  24. // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
  25. //#if defined (__AVR_ATtiny85__)
  26. if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  27. //#endif
  28. // End of trinket special code
  29.  
  30. pixels.begin(); // This initializes the NeoPixel library.
  31. }
  32.  
  33. void loop() {
  34.  
  35. // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
  36.  
  37. for(int a=0;a<NUMPIXELS;a++)
  38. for(int b=1;b<NUMPIXELS;b++)
  39. for(int c=2;b<NUMPIXELS;c++)
  40. for(int d=3;d<NUMPIXELS;d++)
  41. for(int e=4;e<NUMPIXELS;e++)
  42. for(int f=5;f<NUMPIXELS;f++)
  43. for(int g=6;g<NUMPIXELS;g++)
  44. //for(int h=7;h<NUMPIXELS;h++)
  45. //for(int i=8;i<NUMPIXELS;i++)
  46. //for(int e=4;e<NUMPIXELS;e++)
  47. //for(int a=0;a<NUMPIXELS;a++)
  48. //for(int b=1;b<NUMPIXELS;b++)
  49. //for(int c=2;b<NUMPIXELS;c++)
  50. //for(int d=3;d<NUMPIXELS;d++)
  51. //for(int e=4;e<NUMPIXELS;e++)
  52. {
  53.  
  54.  
  55. // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
  56. pixels.setPixelColor(a, pixels.Color(0,0,255)); // Moderately bright green color.
  57. pixels.setPixelColor(b, pixels.Color(0,0,255));
  58. pixels.setPixelColor(c, pixels.Color(0,0,255));
  59. pixels.setPixelColor(d, pixels.Color(140,45,14));
  60. pixels.setPixelColor(e, pixels.Color(0,255,0));
  61. pixels.setPixelColor(f, pixels.Color(95,224,233));
  62. pixels.setPixelColor(g, pixels.Color(255,128,0));
  63.  
  64.  
  65.  
  66.  
  67. pixels.show(); // This sends the updated pixel color to the hardware.
  68.  
  69. delay(delayval); // Delay for a period of time (in milliseconds).
  70.  
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement