Menu
Index
Engineering
Entertainment
Literature
Miscellaneous
Contact
Search
tiktok.com/@pkvi.xyz
scored.co/u/pkvi_mv
Why Ayh?
Miter
Miter
@pkvi
"...may not meet professional standards."
1767 miters
123 tenons
Subscribe
0.0131
Adafruit Hysteria Mask


Adafruit Metro Mini
(6) Neopixels
LM393 Microphone Sensor Module
(2) 3V CR2032 Coin Cell
(3) Blue LEDs
Glow in the Dark Filament



  1. // hysteria mask
  2. // pkvi
  3. #include "FastLED.h"
  4. #define NUM_LEDS 3
  5. CRGB leds[NUM_LEDS];
  6. #define PIN 13
  7. int fade_state = 0;
  8. const int sound = 12;
  9. const int mouth = 11;
  10. int sound_state = 0;
  11. void setup() {
  12. FastLED.addLeds<WS2812, PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  13. pinMode(sound, INPUT);
  14. pinMode(mouth, OUTPUT);
  15. digitalWrite(mouth, LOW);
  16. delay(2000);
  17. }
  18. void loop() {
  19. if (fade_state == 0) {
  20. fadein(0x00, 0x00, 0xff);
  21. fade_state = 1;
  22. }
  23. sound_state = digitalRead(sound);
  24. if (sound_state == 1) {
  25. digitalWrite(mouth, HIGH);
  26. } else {
  27. digitalWrite(mouth, LOW);
  28. }
  29. }
  30. void fadein(byte red, byte green, byte blue) {
  31. float r, g, b;
  32. for (int k = 0; k < 256; k = k + 1) {
  33. r = (k / 256.0) * red;
  34. g = (k / 256.0) * green;
  35. b = (k / 256.0) * blue;
  36. setAll(r, g, b);
  37. showStrip();
  38. delay(5);
  39. }
  40. }
  41. void showStrip() {
  42. #ifdef ADAFRUIT_NEOPIXEL_H
  43. strip.show();
  44. #endif
  45. #ifndef ADAFRUIT_NEOPIXEL_H
  46. FastLED.show();
  47. #endif
  48. }
  49. void setPixel(int Pixel, byte red, byte green, byte blue) {
  50. #ifdef ADAFRUIT_NEOPIXEL_H
  51. strip.setPixelColor(Pixel, strip.Color(red, green, blue));
  52. #endif
  53. #ifndef ADAFRUIT_NEOPIXEL_H
  54. leds[Pixel].r = red;
  55. leds[Pixel].g = green;
  56. leds[Pixel].b = blue;
  57. #endif
  58. }
  59. void setAll(byte red, byte green, byte blue) {
  60. for (int i = 0; i < NUM_LEDS; i++ ) {
  61. setPixel(i, red, green, blue);
  62. }
  63. showStrip();
  64. }

Adafruit Metro Mini
LM393 Microphone Sensor Module
Neopixels
(2) 3V CR2032 Coin Cell
(2) Blue LEDs


  1. // hysteria mask (2)
  2. // pkvi
  3. #include "FastLED.h"
  4. #define NUM_LEDS 15
  5. CRGB leds[NUM_LEDS];
  6. #define PIN 3
  7. const int sound = 12;
  8. int sound_state = 0;
  9. int k;
  10. const int ledone = 5;
  11. const int ledtwo = 6;
  12. int ledstate = 0;
  13. void setup() {
  14. FastLED.addLeds<WS2812B, PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  15. pinMode(sound, INPUT);
  16. pinMode(ledone, OUTPUT);
  17. pinMode(ledtwo, OUTPUT);
  18. for (k = 0; k < 30; k++) {
  19. setAll(0, 0, k);
  20. showStrip();
  21. }
  22. }
  23. void loop() {
  24. sound_state = digitalRead(sound);
  25. if (sound_state == 1) {
  26. if (k == 30) {
  27. for (k = 30; k < 255; k++) {
  28. setAll(0, 0, k);
  29. showStrip();
  30. k = k + 10;
  31. digitalWrite(ledone, 0);
  32. digitalWrite(ledtwo, 0);
  33. }
  34. delay(100);
  35. } else {
  36. setAll(0, 0, 255);
  37. showStrip();
  38. digitalWrite(ledone, 0);
  39. digitalWrite(ledtwo, 0);
  40. delay(100);
  41. }
  42. } else {
  43. if (k == 255) {
  44. for (k = 255; k > 30; k--) {
  45. setAll(0, 0, k);
  46. showStrip();
  47. k = k;
  48. }
  49. } else {
  50. setAll(0, 0, 30);
  51. showStrip();
  52. if (ledstate > 200 && ledstate < 400) {
  53. analogWrite(ledone, 80);
  54. analogWrite(ledtwo, 0);
  55. ledstate++;
  56. } else if (ledstate == 400) {
  57. ledstate = 0;
  58. analogWrite(ledone, 0);
  59. analogWrite(ledtwo, 80);
  60. } else {
  61. analogWrite(ledone, 0);
  62. analogWrite(ledtwo, 80);
  63. ledstate++;
  64. }
  65. }
  66. }
  67. }
  68. void showStrip() {
  69. #ifdef ADAFRUIT_NEOPIXEL_H
  70. strip.show();
  71. #endif
  72. #ifndef ADAFRUIT_NEOPIXEL_H
  73. FastLED.show();
  74. #endif
  75. }
  76. void setPixel(int Pixel, byte red, byte green, byte blue) {
  77. #ifdef ADAFRUIT_NEOPIXEL_H
  78. strip.setPixelColor(Pixel, strip.Color(red, green, blue));
  79. #endif
  80. #ifndef ADAFRUIT_NEOPIXEL_H
  81. leds[Pixel].r = red;
  82. leds[Pixel].g = green;
  83. leds[Pixel].b = blue;
  84. #endif
  85. }
  86. void setAll(byte red, byte green, byte blue) {
  87. for (int i = 0; i < NUM_LEDS; i++ ) {
  88. setPixel(i, red, green, blue);
  89. }
  90. showStrip();
  91. }