Menu
Index
Engineering
Entertainment
Literature
Miscellaneous
Contact
Search
tiktok.com/@pkvi.xyz
buymeacoffee.com/pkvi
scored.co/u/pkvi_mv
Miter
Why Ayh?
Miter
@pkvi
"...may not meet professional standards."
776 miters
122 tenons
Subscribe
0.00155
Six Shooter Glue Gun


Arduino Nano
(2) 9MG90S Servo
USB 120V to 5V
5V Laser
Toggle Switch
Momentary Button




  1. // six shooter glue gun
  2. // pkvi
  3. #include "FastLED.h"
  4. #define NUM_LEDS 1
  5. #define LED_TYPE WS2812B
  6. #define COLOR_ORDER GRB
  7. CRGB leds[NUM_LEDS];
  8. #include <Servo.h>
  9. Servo rounds;
  10. Servo chamber;
  11. const int r_pin = 2;
  12. const int c_pin = 3;
  13. const int butt = 4;
  14. const int neo = 5;
  15. int b_state;
  16. int c_open = 40;
  17. int c_close = 165;
  18. int r_rotate = 95;
  19. int r_stop = 90;
  20. void setup() {
  21. Serial.begin(9600);
  22. FastLED.addLeds<LED_TYPE, neo, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  23. pinMode(butt, INPUT_PULLUP);
  24. rounds.attach(r_pin);
  25. rounds.write(r_stop);
  26. rounds.detach();
  27. chamber.attach(c_pin);
  28. chamber.write(c_open);
  29. delay(100);
  30. chamber.detach();
  31. neoshow(0, 0, 255);
  32. delay(1000);
  33. neoshow(0, 0, 0);
  34. }
  35. void loop() {
  36. b_state = digitalRead(butt);
  37. if (b_state == LOW) {
  38. load_glue();
  39. }
  40. }
  41. void load_glue() {
  42. neoshow(255, 0, 0);
  43. rounds.attach(r_pin);
  44. rounds.write(r_rotate);
  45. delay(270);
  46. rounds.write(r_stop);
  47. rounds.detach();
  48. delay(500);
  49. chamber.attach(c_pin);
  50. chamber.write(c_close);
  51. delay(500);
  52. chamber.write(c_open);
  53. delay(200);
  54. chamber.detach();
  55. neoshow(0, 0, 0);
  56. }
  57. void neoshow (int r, int g, int b) {
  58. for (int v = 0; v < NUM_LEDS; v++) {
  59. leds[v] = CRGB (r, g, b);
  60. FastLED.show();
  61. }
  62. }