Pith - arduino_six_shooter_glue_gun
arduino_six_shooter_glue_gun/arduino_six_shooter_glue_gun.ino [1.2 kb]
Modified: 17:56:22 58 026 (16 May 026)
14 Days Ago
// six shooter glue gun
// vgmlr
#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();
  }
}
Updates
Shim - Android 70.026.1
Wedge - Linux 68.026.1
Wedge - Android 68.026.1
Taper - Linux 64.026.1
Ayh Extension - Chrome 63.026.1
Dev
TVShow (227) 'CSA'
TVShow (228) 'APT'
TVProgram (83) 'BXT'
Miter Update(s)
Shim (Dictation)

Menu
Calendar
Project Tin (024/029)
Miter
RSS Feed
User Avatar
@vgmlr
=SUM(parts)