         //   d88P      
         //  d88P        
         // d8888888888 
-		//======================================================================  		
+	//======================================================================  		
 		
-		digitalWrite(pinDirZ, directZ);
-		if(speedZ != 0)
-  		{
-  			unsigned long currentZ = millis();
-  			if (currentZ - previousMillisZ >= speedZ) 
-    		{
-      			previousMillisZ = currentZ;
-  
-    	 		digitalWrite(pinStepY, 1);
+	digitalWrite(pinDirZ, directZ);
+	if(speedZ != 0)
+  	{
+  	    unsigned long currentZ = millis();
+  		
+	    if (currentZ - previousMillisZ >= speedZ) 
+    	    {
+      		previousMillisZ = currentZ;
+  
+		digitalWrite(pinStepY, 1);
     	    	delayMicroseconds( 500 );
     	    	digitalWrite(pinStepY, 0);
     	    	delayMicroseconds( 500 );
     	    	if(directZ) Zangle++;
     	    	else Zangle--;
-  			} 
-  		}
-  		if(Zangle == 201) Zangle = 0;
-  		if(Zangle == -1)  Zangle = 0;
-  		
-  
-  }
- 
-
-  
-
-  
-  	// SEND SERIAL DATA
+  	    } 
+  	}
+  	
+	if(Zangle == 201) Zangle = 0;
+  	if(Zangle == -1)  Zangle = 0;
+	    
+    }
+
+    // TRIGGER / SEC
     //-------------------------------------------------------------------------// 
     unsigned long currentS = millis(); // millis();
 

    	else LED_PING = true;
    	digitalWrite(PING, LED_PING);
    	
    	
  
    	
    	
    	
    	if(!accelgyro.testConnection());
    	{
    		production = false;
    		emgStop = true;
    		accelgyro.initialize();
    		if(accelgyro.testConnection())
    		{
    			production = true;
    		}
    	}
    	
    	
    	
    	/*
    	
    	// SEND STATUT

    	Serial.println(" ");
    	
    	*/
    } // ENF OF PRODUCTION
} // END OF LOOP

// VOID FOR TAKE THE CURRENT
int current(int Cpin)
{
    int mVperAmp = 185; // use 100 for 20A Module and 66 for 30A Module
    int RawValue= 0;
    int ACSoffset = 2500; 
    double Voltage = 0;
    double Amps = 0;

    RawValue = analogRead(Cpin);
    Voltage = (RawValue / 1024.0) * 5000; // Gets you mV
    Amps = ((Voltage - ACSoffset) / mVperAmp);
 
    return(Amps);
}

// VOID FOR TAKE THE BATTERY VOLTAGE
int voltage(int Vpin)
{
    float vout = 0.0;
    float vin = 0.0;
    float R1 = 100000.0; // resistance of R1 (100K) -see text!
    float R2 = 10000.0; // resistance of R2 (10K) - see text!
    int value = 0;

    value = analogRead(Vpin);
    vout = (value * 5.0) / 1024.0;
    vin = vout / (R2/(R1+R2)); 
    if (vin<0.09) vin=0.0;
   
    return(vin);
}
