Installation (by n&n) for hostage release vigils (Israel, 2023). Functions as a centerpiece for meditation circles by Roaring Silence
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

neopixel-twinkle.ino 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Twinkling neopixel led strip. Used for "Each name a star"
  2. // installation at hostage release vigils 2023
  3. // by Roaring Silence https://shtika2023.org
  4. // * Connect strip to pin 6, gnd, and +5V
  5. // * Set LED_COUNT according to your strip's LED counts
  6. // * You might need to change NEO_* arguments to fit your hardware
  7. // NEOPIXEL BEST PRACTICES for most reliable operation:
  8. // - Add 1000 uF CAPACITOR between NeoPixel strip's + and - connections.
  9. // - MINIMIZE WIRING LENGTH between microcontroller board and first pixel.
  10. // - NeoPixel strip's DATA-IN should pass through a 300-500 OHM RESISTOR.
  11. // - AVOID connecting NeoPixels on a LIVE CIRCUIT. If you must, ALWAYS
  12. // connect GROUND (-) first, then +, then data.
  13. // - When using a 3.3V microcontroller with a 5V-powered NeoPixel strip,
  14. // a LOGIC-LEVEL CONVERTER on the data line is STRONGLY RECOMMENDED.
  15. // (Skipping these may work OK on your workbench but can fail in the field)
  16. #include <Adafruit_NeoPixel.h>
  17. #ifdef __AVR__
  18. #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
  19. #endif
  20. // Which pin on the Arduino is connected to the NeoPixels?
  21. // On a Trinket or Gemma we suggest changing this to 1:
  22. #define LED_PIN 6
  23. // How many NeoPixels are attached to the Arduino?
  24. #define LED_COUNT 55
  25. // Declare our NeoPixel strip object:
  26. Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_RGB + NEO_KHZ800);
  27. // Argument 1 = Number of pixels in NeoPixel strip
  28. // Argument 2 = Arduino pin number (most are valid)
  29. // Argument 3 = Pixel type flags, add together as needed:
  30. // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
  31. // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
  32. // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
  33. // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
  34. // NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
  35. #define P_TWINKLE 0.15
  36. #define DECAY_FACTOR 0.023
  37. #define CUTOFF_LEVEL 0.1
  38. #define R_FACTOR 191
  39. #define G_FACTOR 127
  40. #define B_FACTOR 31
  41. #define CYCLE_MILLIS 23
  42. #define MIN_INITIAL 0.75
  43. #define MAX_INITIAL 1.0
  44. #define FRAND(minval, maxval) (random(minval*1000, maxval*1000)/1000.0)
  45. float levels[LED_COUNT] = { 0.0 };
  46. // setup() function -- runs once at startup --------------------------------
  47. void setup() {
  48. // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  49. // Any other board, you can remove this part (but no harm leaving it):
  50. #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  51. clock_prescale_set(clock_div_1);
  52. #endif
  53. // END of Trinket-specific code.
  54. strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
  55. strip.show(); // Turn OFF all pixels ASAP
  56. strip.setBrightness(191); // Set BRIGHTNESS to about 1/5 (max = 255)
  57. }
  58. // loop() function -- runs repeatedly as long as board is on ---------------
  59. void loop() {
  60. if (FRAND(0.0, 1.1) < P_TWINKLE) {
  61. levels[random(0, LED_COUNT)] = FRAND(MIN_INITIAL, MAX_INITIAL);
  62. }
  63. for (int i = 0; i < LED_COUNT; i++) { // For each pixel in strip...
  64. levels[i] *= (1 - DECAY_FACTOR);
  65. if (levels[i] < CUTOFF_LEVEL) {
  66. levels[i] = 0.0;
  67. }
  68. strip.setPixelColor(i, strip.Color(R_FACTOR * levels[i], G_FACTOR * levels[i], B_FACTOR * levels[i])); // Set pixel's color (in RAM)
  69. }
  70. strip.show(); // Update strip to match
  71. delay(CYCLE_MILLIS); // Pause for a moment
  72. }