void MenuCalibra()

{

   float maxesc[]={128.,2.57,4.25};



   int opcoes[]={0,0,0}, opcaoant=-1, indice=0;

   char tarefa[2][13];

   tarefa[0]="Reto";

   tarefa[1]="Roda";



   sleep(.3);



   while(!(stop_button()&&start_button()))

   {

      opcoes[indice]=(int)((float)knob()/maxesc[indice]);



      if (opcoes[indice]!=opcaoant)

      {

          printf("Mod:%s Pot:%d Tmp:%f \n", tarefa[opcoes[0]], opcoes[1], (float)opcoes[2]/10.);

      }

     

      if ((start_button())&&(indice<3))

      {

         indice++;

         sleep(.3);

      }

      if ((stop_button())&&(indice>0))

      {

         indice--;

         sleep(.3);

      }



      if (indice==3)

      { 

         calibra(opcoes);

         indice--;

         opcaoant=-1; 

      }

      

      opcaoant=opcoes[indice];



      sleep(.1);

   }



}



int calibra(int opcoes[])

{

   system_print_off();

   motor(0,opcoes[1]);

   

   if (!opcoes[0])

      motor(1,opcoes[1]);

   else

      motor(1,-opcoes[1]);     

   

   sleep((float)opcoes[2]/10.);

   

   alloff();



   system_print_on();



}
cursos/introrobotica/2008-2/grupo2/calibra.c.txt · Última modificação: 2008/11/12 15:18 por introrobg02