       }
    }
    peakToPeak = signalMax - signalMin;
-   Serial.println("peakToPeak: " + String(peakToPeak));
+   // Serial.println("peakToPeak: " + String(peakToPeak));
+   if(peakToPeak < 0)
+      peakToPeak = 0;
 
    // map 1v p-p level to the max scale of the display
    int displayPeak = map(peakToPeak, 0, 1023, 0, maxScale);
-   Serial.println("displayPeak: " + String(displayPeak));
-
-   // draw the new sample
-   for (int i = 0; i < maxScale; i++)
+   if(displayPeak < 0)
+    displayPeak = 0;
+   Serial.println("peakToPeak: " + String(peakToPeak) + "   displayPeak: " + String(displayPeak));
+
+   //upside down now
+   displayPeak = maxScale - displayPeak;
+   for (int i = maxScale; i >= 0; i--)
    {
-      if (i >= displayPeak)  
+      if (i < displayPeak)  
       {
          setRow(i, strip.Color(0,0,0));
       }
-      else if (i < redZone) 
-      {
-        setRow(i, strip.Color(0,255,0));
-      }
-      else
+      else if (i >= orangeZone) //green
+      {
+        setRow(i, Wheel(colorCount));
+      }
+      else if (i <= orangeZone + redZone && i > redZone) //orange
+      {
+        setRow(i, strip.Color(255,128,0));
+      }
+      else //red
       {
         setRow(i, strip.Color(255,0,0));
       }
    }
+
+   if(colorCount >= MAX_COLOR)
+    colorCount = 0;
+   else
+    colorCount++;
+
    strip.show();
 }
-
-// void loop()
-// {
-//     // Serial.println("IP:" + String(ip));
-//     //TCPServer/Client connections
-//     if (client.connected()) {
-//         String("CONNECTED").toCharArray(tcpstate, 64);
-//         String dStr = "";
-//         char data;
-//         while (client.available()) 
-//         {
-//             data = client.read();
-//             dStr += String(data);
-//         }
-//         // client.println("OK:" + dStr);
-//         // client.flush();
-//         // Serial.println("dStr: " + String(dStr));
-//         loopArgs = stringSplit(dStr, ',');
-//         action = loopArgs[0];
-//         // dStr.toCharArray(action, 64);
-//         // loopRun = action;
-//         // client.stop();
-//     } 
-//     else 
-//     {
-//         // if no client is yet connected, check for a new connection
-//         // Serial.println("DISCONNECT");
-//         String("DISCONNECTED").toCharArray(tcpstate, 64);
-//         client = server.available();
-//         if(client.connected())
-//             return;
-//     }
-
-//     if(action == SETROW)
-//     {
-//       setRow(stringToInt(loopArgs[1]), strip.Color(stringToInt(loopArgs[0]),
-//                                                    stringToInt(loopArgs[1]),
-//                                                    stringToInt(loopArgs[2])));
-//       strip.show();
-//       action = STOP;
-//     }
-// }
 
 void setRow(int row, int color)
 {

    return strArr;
}


   while (millis() - startMillis < sampleWindow)
   {
      sample = analogRead(A0) / 4;
      // Serial.println("sample: " + String(sample));
      if (sample < 1024)  // toss out spurious readings
      {
         if (sample > signalMax)
