loading

It is time for the MLB to join the modern era by translating the often unclear umpire muttering and connecting them to the rest of us at home. In our first #OneDayBuild comes the Arduino Umpire Mask that delivers an immediate visual response to that crucial life or death call.

Not a software designer, so simply close your eyes and imagine that the Counter App is also IoT and seamlessly updating several resources.

Shout out to umpires young and old who wear these bulbous masks; holy cripes! Shout out to Leslie Nielsen -- you are missed.

// Arduino Umpire Mask
// TVMiller

#include 

// Neopixel Data Pins
#define PINSTRIP 3
#define PINPIXEL 4

// LED Count and Setup
Adafruit_NeoPixel strip = Adafruit_NeoPixel(15, PINSTRIP, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(6, PINPIXEL, NEO_GRB + NEO_KHZ800);

// Strike Count
int strikes = 0;
// Ball Count
int balls = 0;

// Bluetooth Data
char call = 0;

void setup() {

  Serial.begin(9600);

  strip.begin();
  strip.show();
  pixels.begin();
  colorWipe(strip.Color(255, 0, 0), 50);
}

void loop() {

  // Clear Strip
  colorWipe(strip.Color(0, 0, 0), 50);

  if (Serial.available() > 0) {
    call = Serial.read();
    if (call == '1') {
      colorWipe(strip.Color(255, 0, 0), 50);
      strike();
      delay(1000);
    }
    else if (call == '2') {
      colorWipe(strip.Color(0, 255, 0), 50);
      ball();
      delay(1000);
    }
    else if (call == '3') {
      reload();
    }
  }
}

void strike() {
  if (strikes == 0) {
    // Red Strike Count
    pixels.setPixelColor(5, pixels.Color(255, 0, 0));
    strikes = 1;
  }
  else if (strikes == 1) {
    pixels.setPixelColor(4, pixels.Color(255, 0, 0));
  }
  pixels.show();
}

void ball() {
  if (balls == 0) {
    // Green Ball
    pixels.setPixelColor(0, pixels.Color(0, 255, 0));
    balls = 1;
  }
  else if (balls == 1) {
    pixels.setPixelColor(1, pixels.Color(0, 255, 0));
    balls = 2;
  }
  else if (balls == 2) {
    pixels.setPixelColor(2, pixels.Color(0, 255, 0));
  }
  pixels.show();
}

void reload() {
  colorWipe(strip.Color(255, 0, 0), 50);
  pixels.setPixelColor(0, pixels.Color(0, 0, 0));
  pixels.setPixelColor(1, pixels.Color(0, 0, 0));
  pixels.setPixelColor(2, pixels.Color(0, 0, 0));
  pixels.setPixelColor(4, pixels.Color(0, 0, 0));
  pixels.setPixelColor(5, pixels.Color(0, 0, 0));
  strikes = 0;
  balls = 0;
  pixels.show();
}

void colorWipe(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

About This Instructable

80views

3favorites

License:

Bio: Privateer
More by TVMiller:Arduino Splash Resistant Toilet Foamer Arduino Motion Mute 1992 Isuzu Trooper Windshield Wiper Single Button Hack 
Add instructable to: