 //  }
 //  Serial.println();
 //}
+
+/** 
+ *
+ * DISTANCE SENSOR
+ *
+ **/
+
+long readSensor(){
+  // The same pin is used to read the signal from the PING))): a HIGH
+  // pulse whose duration is the time (in microseconds) from the sending
+  // of the ping to the reception of its echo off of an object.
+  triggerSensor();
+
+  pinMode(PIN_SENSOR, INPUT);
+  long duration = pulseIn(PIN_SENSOR, HIGH);
+  
+  // convert the time into a distance
+  return microsecondsToCentimeters(duration);
+}
+
+void triggerSensor(){
+  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
+  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
+  pinMode(PIN_SENSOR, OUTPUT);
+  digitalWrite(PIN_SENSOR, LOW);
+  delayMicroseconds(2);
+  digitalWrite(PIN_SENSOR, HIGH);
+  delayMicroseconds(5);
+  digitalWrite(PIN_SENSOR, LOW);  
+}
  
-//int microsecondsToCentimeters(long microseconds)
-//{
-//  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
-//  // The ping travels out and back, so to find the distance of the
-//  // object we take half of the distance travelled.
-//  return microseconds / 29 / 2;
-//}
-
-
+int microsecondsToCentimeters(long microseconds)
+{
+  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
+  // The ping travels out and back, so to find the distance of the
+  // object we take half of the distance travelled.
+  return microseconds / 29 / 2;
+}
+
+

#define NUMBER_STRIPS 3

#define PIN_SWITCH 2

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMBER_LEDS, PIN_STRIP, NEO_GRB + NEO_KHZ800);


#include <NewPing.h>

//Max and Min value for the distance sensor
float maxDistance = 500;
float minDistance = 10;

// # Cable management sensors #
