     int q=M*diff+B;
 
 //    Serial commands for testing
-    Serial.print(M);
-    Serial.print("   ");
-    Serial.print(B);
-    Serial.print("   ");
-    Serial.print(diff);
-    Serial.print("   ");
-    Serial.print(q);
-    Serial.print("   ");
-    Serial.println(Q);
+//    Serial.print(M);
+//    Serial.print("   ");
+//    Serial.print(B);
+//    Serial.print("   ");
+//    Serial.print(diff);
+//    Serial.print("   ");
+//    Serial.print(q);
+//    Serial.print("   ");
+//    Serial.println(Q);
 //*/
 
     lastdiff=diff;


// decay function definitions
int readperiod=3000; // the time over which we take and average readings
int baseline; // baseline, to be calculated every readperiod
int currentavg; // average, taken every readperiod, just in case
int Q = 1000; // "penalty" value, 1 s to start

    analogWrite(vibpin,amp);

    checkpublish("sl");
    checkpublish("sd");
    checkpublish("p");

}

void checkpublish(String command) {

  if (command=="serial" || command=="sl") {
    Serial.print(analogvalue);
    Serial.print("    ");
