{"id":5574,"date":"2024-09-20T17:05:26","date_gmt":"2024-09-20T21:05:26","guid":{"rendered":"https:\/\/dkc.umw.edu\/?p=5574"},"modified":"2024-09-20T17:05:26","modified_gmt":"2024-09-20T21:05:26","slug":"evelynestallation-blog-post-4","status":"publish","type":"post","link":"https:\/\/dkc.umw.edu\/fellows\/2024\/09\/20\/evelynestallation-blog-post-4\/","title":{"rendered":"Evelynestallation Blog Post #4!"},"content":{"rendered":"\n<p>It&#8217;s been such a busy few weeks that I haven&#8217;t made it into the DKC! However, I do have more fun code! This one is a variation of the code I used in blog post #2, but this time it has sparkles added in. See if you can spot the difference! When I think about coding lights, adding sparkles is both one of my favorite things to do and one of the most difficult because it requires the inclusion of random selection. If I end up hard coding the lights, which I&#8217;m leaning towards, I&#8217;d definitely include this code!<\/p>\n\n\n\n<p>Also, depending on the lights you get, this code may make your lights different colors. It&#8217;s set for RGB lights, which means that red is the first number in the &#8220;pixels.Color(x, 0, y)&#8221; command. However, some lights are GRB lights and would interpret the first number, or x, as the color green. If that&#8217;s the case, you can switch the x value and the 0!<\/p>\n\n\n\n<p>If you want to choose your own colors, you can reference the chart on this website!<\/p>\n\n\n\n<p><a href=\"https:\/\/www.rapidtables.com\/web\/color\/RGB_Color.html\">Rapid Tables RGB Color Chart<\/a><\/p>\n\n\n\n<p>Happy coding!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;Adafruit_NeoPixel.h&gt;\n#ifdef __AVR__\n  #include &lt;avr\/power.h&gt;\n#endif\n#define PIN       5\n#define NUMPIXELS 60\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n#define DELAYVAL 30\n\nvoid setup() {\n#if defined(__AVR_ATtiny85__) &amp;&amp; (F_CPU == 16000000)\n  clock_prescale_set(clock_div_1);\n#endif\n\n  pixels.begin(); \n\n}\n\nvoid loop() {\n\n int x=255;\n  int y = 0; \n  for (int z = 0; z&lt;255; z++){\n   \n     for(int i=0; i&lt;NUMPIXELS; i++) {\n      \n   pixels.setPixelColor(i, pixels.Color(x, 0, y));\n   pixels.show(); \n   \n   \n   }\n   long w= random(0,NUMPIXELS);\n    pixels.setPixelColor(w, pixels.Color(255, 255, 255));\n    pixels.show();\n   delay(DELAYVAL);\n   x--;\n   y++; }\n\n   for (int p = 0; p&lt;255; p++){\n   \n     for(int i=0; i&lt;NUMPIXELS; i++) {\n      \n   pixels.setPixelColor(i, pixels.Color(x, 0, y));\n   pixels.show(); \n   \n   \n   }\n   long w= random(0,NUMPIXELS);\n    pixels.setPixelColor(w, pixels.Color(255, 255, 255));\n    pixels.show();\n   delay(DELAYVAL);\n   x++;\n   y--; }\n   \n } <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been such a busy few weeks that I haven&#8217;t made it into the DKC! However, I do have more fun code! This one is a variation of the code I used in blog post #2, but this time it has sparkles added in. See if you can spot the difference! When I think about [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5574","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dkc.umw.edu\/fellows\/wp-json\/wp\/v2\/posts\/5574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dkc.umw.edu\/fellows\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dkc.umw.edu\/fellows\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dkc.umw.edu\/fellows\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/dkc.umw.edu\/fellows\/wp-json\/wp\/v2\/comments?post=5574"}],"version-history":[{"count":0,"href":"https:\/\/dkc.umw.edu\/fellows\/wp-json\/wp\/v2\/posts\/5574\/revisions"}],"wp:attachment":[{"href":"https:\/\/dkc.umw.edu\/fellows\/wp-json\/wp\/v2\/media?parent=5574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dkc.umw.edu\/fellows\/wp-json\/wp\/v2\/categories?post=5574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dkc.umw.edu\/fellows\/wp-json\/wp\/v2\/tags?post=5574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}