diff --git a/earthquake/earthquake.ino b/earthquake/earthquake.ino
index 4cca062b2b3fe0fb253f812dc13beb57e308180c..be4bab14aa196709e7d934c45de8079485bfb4bc 100644
--- a/earthquake/earthquake.ino
+++ b/earthquake/earthquake.ino
@@ -5,6 +5,18 @@
 #include "Wire.h"
 #endif
 
+int inPin = 8;         // the number of the input pin
+int outPin = 12;       // the number of the output pin
+
+int state = HIGH;      // the current state of the output pin
+int reading;           // the current reading from the input pin
+int previous = LOW;    // the previous reading from the input pin
+
+// the follow variables are long's because the time, measured in miliseconds,
+// will quickly become a bigger number than can be stored in an int.
+long time = 0;         // the last time the output pin was toggled
+long debounce = 200;   // the debounce time, increase if the output flickers
+
 //LCD
 LiquidCrystal lcd(0, 1, 8, 9, 10, 11); /// REGISTER SELECT PIN,ENABLE PIN,D4 PIN,D5 PIN, D6 PIN, D7 PIN
 
@@ -54,6 +66,9 @@ void dmpDataReady() {
 }
 
 void setup() {
+  pinMode(inPin, INPUT);
+  pinMode(outPin, OUTPUT);
+  
   //SEVEN SEGMENT
   pinMode(latchPin, OUTPUT);
   pinMode(dataPin, OUTPUT);
@@ -68,7 +83,7 @@ void setup() {
 
   //LCD
   lcd.begin(16, 2);
-
+  
   //ACCELEROMETER/GYRO
   // join I2C bus (I2Cdev library doesn't do this automatically)
 #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
@@ -171,36 +186,7 @@ void displaySevenSegment(int val){
     digitalWrite(latchPin, HIGH);
 }
 
-void loop() {
-  loopNumber++;
-
-  //  //SEVEN SEGMENT
-  //  digitalWrite(latchPin, LOW);
-  //  shiftOut(dataPin, clockPin, MSBFIRST, digit[9]);
-  //  digitalWrite(latchPin, HIGH);
-  //  magnitude = (magnitude+1)%10;
-  //  delay(250);
-
-  //  //LCD
-  //  lcd.print("   circuit digest");//print name
-  //  lcd.setCursor(0, 1); // set the cursor to column 0, line 2
-  //  lcd.print("ic tronic");//print name
-  //  delay(250);//delay of 0.75sec
-  //  lcd.scrollDisplayLeft();//shifting data on LCD
-  //  lcd.setCursor(0, 0);// set the cursor to column 0, line1
-
-  //  int measurement = analogRead(seismicPin);
-  //  float seismoMag = measurement / 2000000000.0 * 5.0;
-  //  Serial.print("measurment = "); Serial.println(measurement);
-  //  Serial.print("magnitude = "); Serial.println(seismoMag);
-  //  if (seismoMag > 2 && loopNumber - lastSeismoDetected > 10000) {
-  //    lastSeismoDetected = loopNumber;
-  //    // detected
-  //    // send post to http://jauhararifin.cf:8888/api/earthquakes
-  //    // header : content-type = application/x-www-form-urlencoded
-  //    // data = "lat=1&long=1&date=2016-12-06 PM 22:03:36.000Z&strength=" + seismoMag
-  //  }
-
+void accelerometerOn(){
   //ACCELERO/GYRO
   // if programming failed, don't try to do anything
   if (!dmpReady) return;
@@ -239,7 +225,6 @@ void loop() {
     // (this lets us immediately read more without waiting for an interrupt)
     fifoCount -= packetSize;
 
-#ifdef OUTPUT_READABLE_WORLDACCEL
     // display initial world-frame acceleration, adjusted to remove gravity
     // and rotated based on known orientation from quaternion
     mpu.dmpGetQuaternion(&q, fifoBuffer);
@@ -253,7 +238,6 @@ void loop() {
     Serial.print(aaWorld.y);
     Serial.print("\t");
     Serial.println(aaWorld.z);
-#endif
 
     // blink LED to indicate activity
     changeShift();
@@ -270,3 +254,57 @@ void loop() {
     }
   }
 }
+
+void accelerometerOff(){
+  displaySevenSegment(0);
+  digitalWrite(LED_PIN, LOW);
+}
+
+void loop() {
+  loopNumber++;
+
+  //  //SEVEN SEGMENT
+  //  digitalWrite(latchPin, LOW);
+  //  shiftOut(dataPin, clockPin, MSBFIRST, digit[9]);
+  //  digitalWrite(latchPin, HIGH);
+  //  magnitude = (magnitude+1)%10;
+  //  delay(250);
+
+  //  //LCD
+  //  lcd.print("   circuit digest");//print name
+  //  lcd.setCursor(0, 1); // set the cursor to column 0, line 2
+  //  lcd.print("ic tronic");//print name
+  //  delay(250);//delay of 0.75sec
+  //  lcd.scrollDisplayLeft();//shifting data on LCD
+  //  lcd.setCursor(0, 0);// set the cursor to column 0, line1
+
+  //  int measurement = analogRead(seismicPin);
+  //  float seismoMag = measurement / 2000000000.0 * 5.0;
+  //  Serial.print("measurment = "); Serial.println(measurement);
+  //  Serial.print("magnitude = "); Serial.println(seismoMag);
+  //  if (seismoMag > 2 && loopNumber - lastSeismoDetected > 10000) {
+  //    lastSeismoDetected = loopNumber;
+  //    // detected
+  //    // send post to http://jauhararifin.cf:8888/api/earthquakes
+  //    // header : content-type = application/x-www-form-urlencoded
+  //    // data = "lat=1&long=1&date=2016-12-06 PM 22:03:36.000Z&strength=" + seismoMag
+  //  }
+  reading = digitalRead(inPin);
+  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
+    if (state == HIGH)
+      state = LOW;
+    else
+      state = HIGH;
+
+    time = millis();    
+  }
+  digitalWrite(outPin, state);
+  previous = reading;
+
+  if(state == HIGH){
+    accelerometerOn();
+  } else {
+    accelerometerOff();
+  }
+  
+}