Menu
Index
Engineering
Entertainment
Literature
Miscellaneous
Contact
Search
tiktok.com/@pkvi.xyz
buymeacoffee.com/pkvi
scored.co/u/pkvi_halfkdeltaxsq
Miter
Why Ayh?
Miter
@pkvi
"...may not meet professional standards."
322 miters
122 tenons
Subscribe
0.06653
Scrap Stir Plate


Arduino Uno
Linear Softpot
Neopixels Strip
4.7K + 1K Resistor
1000uf Capacitor
80mm Fan
(2) Neodymium Magnets
9V Power Supply



  1. #include <Adafruit_NeoPixel.h>
  2. #define PIN 6
  3. Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);
  4. int p = A0;
  5. int v;
  6. int s;
  7. int h;
  8. int x;
  9. int r;
  10. int g;
  11. int b;
  12. void setup() {
  13. strip.begin();
  14. strip.show();
  15. delay(100);
  16. for (x = 0; x < 1000; x++) {
  17. s = map(analogRead(p), 0, 1024, 0, 255);
  18. }
  19. s = s / 1000;
  20. h = s - 3;
  21. s = s + 3;
  22. colorWipe(strip.Color(0, 0, 255), 50);
  23. }
  24. void loop() {
  25. v = map(analogRead(p), 0, 1024, 0, 255);
  26. if (v >= h && v <= s) {
  27. // ignore empty pot
  28. } else {
  29. if (v <= 42.5) {
  30. r = 255;
  31. g = v * 6;
  32. b = 0;
  33. } else if ((v > 42.5) && (v <= 85)) {
  34. r = 255 - (v - 43) * 6;
  35. g = 255;
  36. b = 0;
  37. } else if ((v > 85) && (v <= 127.5)) {
  38. r = 0;
  39. g = 255;
  40. b = (v - 85) * 6;
  41. } else if ((v > 127.5) && (v <= 170)) {
  42. r = 0;
  43. g = 255 - (v - 127.5) * 6;
  44. b = 255;
  45. } else if ((v > 170) && (v <= 212.5)) {
  46. r = (v - 170) * 6;
  47. g = 0;
  48. b = 255;
  49. } else if ((v > 212.5) && (v <= 255)) {
  50. r = 255;
  51. g = 0;
  52. b = 255 - (v - 212.5) * 6;
  53. }
  54. colorWipe(strip.Color(r, g, b), 50);
  55. }
  56. delay(5);
  57. }
  58. void colorWipe(uint32_t c, uint8_t ) {
  59. for (uint16_t i = 0; i < strip.numPixels(); i++) {
  60. strip.setPixelColor(i, c);
  61. strip.show();
  62. }
  63. }