document.write(''); document.write(''); document.write(''); document.write(''); document.write('Paste provided by Paste.ee - View Original - View Raw - Download
'); document.write('
#include <Adafruit_NeoPixel.h>\n#define PIN 6\nAdafruit_NeoPixel strip = Adafruit_NeoPixel(9, PIN, NEO_GRB + NEO_KHZ800);\n\nint x = 150; //change these values to fade between the two.\nint y = 220;\n\nvoid setup() {\n  strip.begin();\n  strip.show(); // Initialize all pixels to \'off\'\n}\n\nvoid loop() {\n  fade(160); //change the number here to adjust the speed\n}\n\nvoid fade(uint8_t wait) {\n  uint16_t i, j;\n\n  //Adjust 60 and 90 to the starting and ending colors you want to fade between. \n  for(j=x; j<y; j++) {\n    for(i=0; i<strip.numPixels(); i++) {\n      strip.setPixelColor(i, Wheel((i+j) & 255));\n    }\n    strip.show();\n    delay(wait);\n  }\n    delay(wait);\n  for(j=y; j>x; j--) {\n    for(i=0; i<strip.numPixels(); i++) {\n      strip.setPixelColor(i, Wheel((i+j) & 255));\n    }\n    strip.show();\n    delay(wait);\n  }\n}\n\n// Input a value 0 to 255 to get a color value.\n// The colours are a transition r - g - b - back to r.\nuint32_t Wheel(byte WheelPos) {\n  if(WheelPos < 85) {\n   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);\n  } else if(WheelPos < 170) {\n   WheelPos -= 85;\n   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);\n  } else {\n   WheelPos -= 170;\n   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);\n  }\n}
'); function initEmbeddedPaste_Xav98qNcyxSE23GR() { hljs.highlightBlock(document.getElementById('pastee-Xav98qNcyxSE23GR-content')); } addEventListener('DOMContentLoaded', initEmbeddedPaste_Xav98qNcyxSE23GR, false); addEventListener('load', initEmbeddedPaste_Xav98qNcyxSE23GR, false);