GoldScrew
Published © Apache-2.0

How to make Security Box following Among Us Game

Today, I will show you how to make a security box following Among Us game - Electrical Wiring Task.

BeginnerFull instructions provided1,340
How to make Security Box following Among Us Game

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
LED (generic)
LED (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Circuit diagram

Code

SecurityBox_AmongUS_Electric_Wiring.ino

Arduino
/*
 * Programming: Security Box Following Among Us - Electric Wiring Task
 * Author: Gold Screw
 * Email: goldscrewdiy@gmail.com
 * Date: Sat, 28 Nov 2020
 */
 
#include <Servo.h> 

// LEFT SIDE LED 
const int L_WhiteLED = 2;
const int L_RedLED = 3;
const int L_YellowLED = 4;
const int L_GreenLED = 5;

// RIGHT SIDE LED
const int R_WhiteLED = 6;
const int R_RedLED = 9;
const int R_YellowLED = 7;
const int R_GreenLED = 8;

const int LockedStatusLED = 11;
const int OpenedStatusLED = 12;

// Servo
Servo locker;

void setup() {

  // Serial connection with baudrate 960
  Serial.begin(9600);

  // PinMode Output
  pinMode(L_WhiteLED, OUTPUT);
  pinMode(L_RedLED, OUTPUT);
  pinMode(L_YellowLED, OUTPUT);
  pinMode(L_GreenLED, OUTPUT);    
  pinMode(LockedStatusLED, OUTPUT);
  pinMode(OpenedStatusLED, OUTPUT);

  // PinMode Input
  pinMode(R_WhiteLED, INPUT);
  pinMode(R_RedLED, INPUT);
  pinMode(R_YellowLED, INPUT);
  pinMode(R_GreenLED, INPUT);

  //======== SERVO MOTOR =======//  
  locker.attach(13);
  locker.write(0);

  //Turn On Left Side LED
  digitalWrite(L_WhiteLED, HIGH);
  digitalWrite(L_RedLED, HIGH);
  digitalWrite(L_YellowLED, HIGH);
  digitalWrite(L_GreenLED, HIGH); 

  // Set LED Locked status
  digitalWrite(LockedStatusLED, HIGH); 
  digitalWrite(OpenedStatusLED, LOW);  
}

void loop() {
    
  // Check all wiring
  if((digitalRead(R_WhiteLED) == 1) && (digitalRead(R_RedLED) == 1) && (digitalRead(R_YellowLED) == 1) && (digitalRead(R_GreenLED) == 1))  
  {
    // Unlocked successfully
    Serial.println("===SUCCESS===");           
    digitalWrite(LockedStatusLED, LOW); 
    digitalWrite(OpenedStatusLED, HIGH);
    
    locker.write(90);
        
  } else {    
    // Unclocked failed
    Serial.println("===FAILED===");
    digitalWrite(LockedStatusLED, HIGH); 
    digitalWrite(OpenedStatusLED, LOW); 
    locker.write(0);   
  }
}

Credits

GoldScrew

GoldScrew

5 projects • 11 followers

Comments