   */
 
     ////////////////////////////////////////////////////////ZERO Z - UPDOWN
-    while (digitalRead(zZeropin) != zZeroNC) {             
-      stepperZdestPosition = stepperZdestPosition + 1;
+    
+    //slightly up while on zeroswitch.
+
+   while (digitalRead(zZeropin) == zZeroNC) {          
+    stepperZdestPosition = stepperZdestPosition + 200;
       while (stepperZdistanceToGo() != 0) {
         stepperZrun();
       }
+   }
+    
+    //back down to zero
+    
+   while (digitalRead(zZeropin) != zZeroNC) {             
+      stepperZdestPosition = stepperZdestPosition - 1;
+      while (stepperZdistanceToGo() != 0) {
+        stepperZrun();
+      }
     }
 
     //top most is equal to tablezsteps
-    stepperZcurrPosition = tablezsteps;
- 
+    stepperZcurrPosition = 0;
     //moves to zero (table surface)
     stepperZdestPosition = 0;      
     while (stepperZdistanceToGo() != 0) {

 * Use arduino toolkit version 1.5.2 or later
 * Make sure you use an Arduino DUE (Or Leonardo)
 * Install aJSON library
 * Install AccelStepper library
 */
#include <aJSON.h>


double stepperYdestPosition = 0;
double stepperYtimer = 0;
int    stepperYtoggle = 0;
double stepperYspeed = 2560;  //slower for more power

int motorpinZstep = 30;
int motorpinZdir  = 31;
