That way you will have to keep your hand pressed to keep the bomb armed. What you need is to be able to tell a transitional state (button down to button up), called button released, not just the current state of a button (up or down).
You can do this:
If button is released, state changes from armed to ready or the other way around.
There are several button libraries that can help you tell transitional states. Here is one I wrote:
Once you install the library, just try the following code:
#include <phi_buttons.h>
phi_buttons arm_ready_button(arm_ready_pin, LOW); // Please don't use digital pin 1 for buttons. Use a different one
void setup(){
Serial.begin(9600);
}
void loop(){
byte temp1=arm_ready_button.sense();
if (temp1==buttons_released)
{
switch (bombState) {
//The bomb is waiting to be armed
case READY:
digitalWrite(LED, HIGH); //Bomb is armed turn LED on
bombState = ARMED;
break;
//The button has been pressed and it now awaits the wireless signal
case ARMED:
digitalWrite(LED, LOW); //Bomb is no longer armed turn LED off
bombState = READY;
if (digitalRead(reciever) == HIGH)
bombState = DETONATED;
break;
//The bomb has recieved the signal and is detonated
case DETONATED:
for (i = 0; i <= 2; i++) {
tone(speakerPin, 5000, 100); //Beeps 3 times at 5000Hz
delay(150);
}
delay(400);
tone(speakerPin, 4500, 3000); //One long beep at 4500Hz
delay(3000);
digitalWrite(LED, LOW); //Bomb is no longer armed turn LED off
bombState = READY;
break;
}
}
}