undefined
Published © GPL3+

Arduino Airsoft Time Bomb [Updated]

All credit for original code/design go to NashBoss100. Small difference between this and the original. Remade to be easier to understand.

BeginnerFull instructions provided1 hour1,842
Arduino Airsoft Time Bomb [Updated]

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1
Blue LED
×1
Resistor 220 ohm
Resistor 220 ohm
×3
Buzzer
Buzzer
×1
Breadboard (generic)
Breadboard (generic)
×1
Male/Male Jumper Wires
×3
Male/Female Jumper Wires
Male/Female Jumper Wires
×10
Button
×1
USB-A to B Cable
USB-A to B Cable
×1
9V battery (generic)
9V battery (generic)
×1
9V Battery Clip
9V Battery Clip
×1
GE Toggle Switch
×1

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

arduino_bomb_schematic-redone_GG6Rn3gqtS.fzz

If it is still hard to understand, tell me what and how in the comments, and I will try to fix it.

Code

Untitled file

C/C++
To make timer last for more time, copy and paste

tone(Speaker, 4000, delays);
digitalWrite(red, HIGH);
delay(delays);
digitalWrite(red, LOW);
digitalWrite(Speaker, LOW);
delay(delays);

several times. To make it last less time, remove

tone(Speaker, 4000, delays);
digitalWrite(red, HIGH);
delay(delays);
digitalWrite(red, LOW);
digitalWrite(Speaker, LOW);
delay(delays);

one by one, testing with a timer until it reaches your liking.
#define red 13
#define Speaker 12
#define blue 8
#define Green 7

float times;
float delays = 1000;
float delays2 = 500;


void setup() {
  Serial.begin(9600);
  pinMode(red, OUTPUT);
  pinMode(Speaker, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(Green, OUTPUT);
  pinMode(2, INPUT_PULLUP);
  myfunction();

}



void myfunction() {

  delays2 = delays2/2.0;
  
  digitalWrite(Green, HIGH);
  tone(Speaker, 2000, delays2);
  delay(delays2);
  digitalWrite(Green, LOW);
  delay(delays2);
  digitalWrite(Green, HIGH);
  tone(Speaker, 2000, delays2);
  delay(delays2);
  digitalWrite(Green, LOW);
  delay(delays2);
  digitalWrite(Green, HIGH);
  tone(Speaker, 2000, delays2);
  delay(delays2);
  digitalWrite(Green, LOW);
  delay(delays2);
  digitalWrite(Green, HIGH);
  tone(Speaker, 2000, delays2);
  delay(delays2);
  digitalWrite(Green, LOW);
  delay(delays2);

}


void loop() {
    Serial.println(digitalRead(2));
  delays = delays/1.03;
 
  if (times < 1200){
    times += 1;
    tone(Speaker, 4000, delays);
    digitalWrite(red, HIGH);
    delay(delays);                     
    digitalWrite(red, LOW);
    digitalWrite(Speaker, LOW);   
    delay(delays); 
    tone(Speaker, 4000, delays);
    digitalWrite(red, HIGH);
    delay(delays);                     
    digitalWrite(red, LOW);
    digitalWrite(Speaker, LOW);   
    delay(delays); 
    tone(Speaker, 4000, delays);
    digitalWrite(red, HIGH);
    delay(delays);                     
    digitalWrite(red, LOW);
    digitalWrite(Speaker, LOW);   
    delay(delays); 
    tone(Speaker, 4000, delays);
    digitalWrite(red, HIGH);
    delay(delays);                     
    digitalWrite(red, LOW);
    digitalWrite(Speaker, LOW);   
    delay(delays); 
    tone(Speaker, 4000, delays);
    digitalWrite(red, HIGH);
    delay(delays);                     
    digitalWrite(red, LOW);
    digitalWrite(Speaker, LOW);   
    delay(delays); 
    tone(Speaker, 4000, delays);
    digitalWrite(red, HIGH);
    delay(delays);                     
    digitalWrite(red, LOW);
    digitalWrite(Speaker, LOW);   
    delay(delays); 
    tone(Speaker, 4000, delays);
    digitalWrite(red, HIGH);
    delay(delays);                     
    digitalWrite(red, LOW);
    digitalWrite(Speaker, LOW);   
    delay(delays); 
    tone(Speaker, 4000, delays);
    digitalWrite(red, HIGH);
    delay(delays);                     
    digitalWrite(red, LOW);
    digitalWrite(Speaker, LOW);   
    delay(delays); 
    tone(Speaker, 4000, delays);
    digitalWrite(red, HIGH);
    delay(delays);                     
    digitalWrite(red, LOW);
    digitalWrite(Speaker, LOW);   
    delay(delays); 
  }
   
     if (times == 1200){
   tone(Speaker, 500, 3000);
   digitalWrite(blue, HIGH);
   delay(19999999);
     
    }
  
      
  if (digitalRead(2) == LOW){
      times = 1230;
      digitalWrite(red, HIGH);
      delay(1000);
      digitalWrite(red, LOW);
      delay(1000);
      digitalWrite(blue, HIGH);
      delay(1000);
      digitalWrite(blue, LOW);
      defuse();

 
  } 
 

}


   

      
void defuse() {

       
      digitalWrite(Green, HIGH);
      tone(Speaker, 2000, 100);
      delay(100);
      digitalWrite(Green, LOW);
      digitalWrite(blue, HIGH);
      tone(Speaker, 1000, 100);
      delay(100);
      digitalWrite(blue, LOW);
      digitalWrite(red, HIGH);
      tone(Speaker, 2000, 100);
      delay(100);
      digitalWrite(red, LOW);
      delay(100);
      digitalWrite(Green, HIGH);
      delay(1999999);
      
}

Credits

NashBoss100

Posted by undefined
Thanks to NashBoss100.

Comments