int speakerPin = 5; 
int buttonPin =  13; 

//when coin is liften, change this value
int coinlifted=0;
int buttonState = 0;    

void setup() {
  pinMode(speakerPin, OUTPUT);      
  pinMode(buttonPin, INPUT);     
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  //when the coin is liften, the circuit is broken
  //and pin 13 will be low! 
  if (buttonState == LOW) {     
    //sound the alarm!  
    coinlifted=1; 
  } 

  //when coin was lifted, play a nasty sound on speakerPin
  if (coinlifted==1)
  {
    digitalWrite(speakerPin, HIGH);
    delay(100);
    digitalWrite(speakerPin, LOW);
    delay(100);
  }

}
