Six Shooter Glue Gun

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



// six shooter glue gun
// vije miller

#include "FastLED.h"
#define NUM_LEDS 1
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];

#include <Servo.h>
Servo rounds;
Servo chamber;
const int r_pin = 2;
const int c_pin = 3;
const int butt = 4;
const int neo = 5;

int b_state;
int c_open = 40;
int c_close = 165;
int r_rotate = 95;
int r_stop = 90;

void setup() {
Serial.begin(9600);
FastLED.addLeds<LED_TYPE, neo, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
pinMode(butt, INPUT_PULLUP);
rounds.attach(r_pin);
rounds.write(r_stop);
rounds.detach();
chamber.attach(c_pin);
chamber.write(c_open);
delay(100);
chamber.detach();
neoshow(0, 0, 255);
delay(1000);
neoshow(0, 0, 0);
}

void loop() {
b_state = digitalRead(butt);
if (b_state == LOW) {
load_glue();
}
}

void load_glue() {
neoshow(255, 0, 0);
rounds.attach(r_pin);
rounds.write(r_rotate);
delay(270);
rounds.write(r_stop);
rounds.detach();
delay(500);
chamber.attach(c_pin);
chamber.write(c_close);
delay(500);
chamber.write(c_open);
delay(200);
chamber.detach();
neoshow(0, 0, 0);
}

void neoshow (int r, int g, int b) {
for (int v = 0; v < NUM_LEDS; v++) {
leds[v] = CRGB (r, g, b);
FastLED.show();
}
}




@pkvi
"...may not meet professional standards."
12,168 miters
0 miters today
203 tenons
Subscribe