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

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

#define MAX_DISTANCE 500
#define INVALID_DATA -1
#define RANGE_HIGH 50
#define RANGE_LOW 5

#define SONAR_NUM 4
#define MEDIAN 8

#define ADDR_SELECT 4
#define ENABLE 2

  Wire.onRequest(requestEvent);
}

int loopCount = 0;

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

void report() {
