 
 void loop()
 {
-  digitalWrite(ledRedPin, LOW);
-  digitalWrite(ledGreenPin, LOW);
-  digitalWrite(ledBluePin, LOW);
-  //wSerial1.println("-------");
-  if(Serial.available())
-  {
-    checkSerial();
-  }
-  allSet_module(moduleLED.Color(0,0,0),0);
-  //Serial1.println(module);
+  //Process any incoming serial data
+  readData = "";
+  if(Serial.available() > 0)
+  {
+    readData = Serial.readString();
+  }
+  delay(100);
+  Serial.flush();
+  
+  char sz[readData.length() + 1];
+  char copy[readData.length() + 1];
+  strcpy(sz, readData.c_str());  
+  char *p = sz;
+  char *str;
+  int delimeter = 0;
+  String readData2 = ""; 
+  Serial2.println(readData);
+  
+  //Split up string into substrings separated by spaces
+  //Go through each substring and extract data
+  while((str = strtok_r(p," ",&p))!=NULL)
+  {
+    readData2 = String(str);
+    //Serial.println(readData2);
+    delimeter = readData2.indexOf('=');
+    if(readData2.substring(0,delimeter)=="Disco")
+    {
+      Disco = true; 
+    }
+    else if (readData2.substring(0, delimeter) == "NULLIFY")
+    {
+      NULLIFY = int((readData2.substring(delimeter + 1)).toFloat());
+    }
+    if(readData2.substring(0,delimeter)=="V2A")
+    {
+      V2A = (readData2.substring(delimeter+1)).toFloat();
+    }
+    else if(readData2.substring(0,delimeter)=="V2B")
+    {
+      V2B = (readData2.substring(delimeter+1)).toFloat();
+    }
+    else if(readData2.substring(0,delimeter)=="V4A")
+    {
+      V4A = (readData2.substring(delimeter+1)).toFloat();
+    }
+    else if(readData2.substring(0,delimeter)=="V4B")
+    {
+      V4B = (readData2.substring(delimeter+1)).toFloat();
+    }
+    else if(readData2.substring(0,delimeter)=="V1A")
+    {
+      V1A = (readData2.substring(delimeter+1)).toFloat();
+    }
+    else if(readData2.substring(0,delimeter)=="V1B")
+    {
+      V1B = (readData2.substring(delimeter+1)).toFloat();
+    }
+    else if(readData2.substring(0,delimeter)=="V3A")
+    {
+      V3A = (readData2.substring(delimeter+1)).toFloat();
+    }
+    else if(readData2.substring(0,delimeter)=="V3B")
+    {
+      V3B = (readData2.substring(delimeter+1)).toFloat();
+    }
+    //module Selection
+    else if(readData2.substring(0,delimeter)=="ISS")
+    {
+      module = String((readData2.substring(delimeter+1)));
+    }
+  }
+
+  module.trim(); //trim whitespace off serial data
+
   if(module == "SM")
   {
     moduleLED.setPixelColor(0, moduleLED.Color(255,255,255));
-    moduleLED.show();
-    //Serial1.println("SM");
   }
   else if(module == "FGB")
   {
     moduleLED.setPixelColor(1, moduleLED.Color(255,255,255));
-    moduleLED.show();
-    //Serial1.println("FGB");
   }
   else if(module == "Node1")
   {
     moduleLED.setPixelColor(2, moduleLED.Color(255,255,255));
-    moduleLED.show();
-    //Serial1.println("Node1");
   }
   else if(module == "Node2")
   {
     moduleLED.setPixelColor(6, moduleLED.Color(255,255,255));
-    moduleLED.show();
-    //Serial1.println("Node2");
   }
   else if(module == "Node3")
   {
     moduleLED.setPixelColor(4, moduleLED.Color(255,255,255));
-    moduleLED.show();
-    //Serial1.println("Node3");
   }
   else if(module == "AL")
   {
     moduleLED.setPixelColor(3, moduleLED.Color(255,255,255));
-    moduleLED.show();
-    //Serial1.println("AL");
   }
   else if(module == "USL")
   {
     moduleLED.setPixelColor(5, moduleLED.Color(255,255,255));
-    moduleLED.show();
-    //Serial1.println("USL");
   }
   else if(module == "Col")
   {
     moduleLED.setPixelColor(7, moduleLED.Color(255,255,255));
-    moduleLED.show();
-    //Serial1.println("Col");
   }
   else if(module == "JEM")
   {
     moduleLED.setPixelColor(8, moduleLED.Color(255,255,255));
-    moduleLED.show();
-    //Serial1.println("JEM");
   }
   else
   {
     allSet_module(moduleLED.Color(0,0,0),0);
-    moduleLED.show();
-  }
+  }
+  moduleLED.show();
   
   if(V2A < 151.5)
   {

double V2B = 0.00;
double V4A = 0.00;
double V4B = 0.00;
String module = "unset module";
boolean Disco = false;
int NULLIFY = 0;

void setup()
{
  pinMode(ledRedPin, OUTPUT);
  pinMode(ledBluePin, OUTPUT);
  pinMode(ledGreenPin, OUTPUT);
//  Serial1.begin(9600);
  Serial.begin(9600);
  Serial.setTimeout(50);
  portIEA.begin();

    theaterChaseRainbow_stbdIEA(50);
  }
  Disco = false;
}

//module led functions
