   return digitalRead(ENABLE);
 }
 
-void requestEvent(){
+void requestEvent() {
   byte buffer[SONAR_NUM * 2];
   memcpy(ranges, buffer, sizeof(buffer));
   Wire.write(buffer, sizeof(buffer));

  Wire.onRequest(requestEvent);
}

void loop() {
  for (int i = 0; i < SONAR_NUM; i++) {
    digitalWrite(IRQ[i], LOW);
    if (isEnabled()) {
      ranges[i] = ping(i);
      if (i % 2) {
        if (ranges[i] < RANGE_LOW) {
          digitalWrite(IRQ[i], HIGH);
        }
      } else {
        if (ranges[i] > RANGE_HIGH) {
          digitalWrite(IRQ[i], HIGH);
        }
      }
      report();
    }
  }
}

void report() {

#include <Wire.h>
#include <NewPing.h>

#define MAX_DISTANCE 250
#define INVALID_DATA -1
#define RANGE_THRESHOLD 10
#define LED13 13

#define SONAR_NUM 4
#define MEDIAN 7

#define ADDR_SELECT 4
#define ENABLE 2
