Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // FUNCION LEER TRAMA  
  2. void modo_manual(){
  3.  
  4.   while(inByte != 'F'){
  5.     if (Serial.available() > 0){
  6.         inByte = Serial.read();
  7.         motor[x] = inByte;
  8.         x++;
  9.         }
  10.   }
  11.   if(inByte == 'F'){
  12.          x=0;
  13.          //lcd.clear();
  14.          MOTORX = motor[0];
  15.          MOTORY = motor[1];
  16.          MOTORZ = motor[2];
  17.   }
  18.   movpaso(MOTORX,MOTORY,MOTORZ);
  19. }  
  20.  
  21. void movpaso(int MOTORX, int MOTORY, int MOTORZ){
  22.  
  23.   m=motorX*MOTORX;
  24.   b=motorY*MOTORY;
  25.   h=motorZ*MOTORZ;
  26.  
  27.   //numero de vueltas en X y Y para hacer el recorrido del objeto
  28.  
  29.   for (int j=1; j<=((MOTORX/10)+1); j++){
  30.    
  31.     if ((j%2)==1)
  32.     {
  33.       for (int i=0; i <=(1.1*MOTORY); i++){
  34.         mymotorY.step(140);
  35.      
  36.       }
  37.      
  38.     }
  39.     else {
  40.       for (int i=0; i <=(1.1*MOTORY); i++){
  41.         mymotorY.step(-140)
  42.       }
  43.      
  44.     }
  45.  
  46.     if(j<=(MOTORX/10)){
  47.       for(int n=0;n<11;n++){
  48.         mymotorX.step(140);
  49.        
  50.       }
  51.     }
  52.   }
  53. }