Vex CORTEX Manual de Instruções Página 135

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 166
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 134
Reference
Project Lead The Way
©
and Carnegie Mellon Robotics Academy
©
/ For use with VEX
®
Robotics Systems
Potentiometers 3
Potentiometers Sample Code
bIfiAutonomousMode = false; //Enable Radio Control mode
while(true
) //Loop forever
{
if(vexRT[Ch5] == 127) //If the top Ch5 button is pressed...
{
if(SensorValue[armPotentiometer] < 900) //If the Potentiometer
{ //has not reached its maximum point...
motor[port6] = 31; //turn the motor on forward.
}
else //If the Potentiometer has reached
{ //its maximum point...
motor[port6] = 0; //turn the motor off.
}
}
if(vexRT[Ch5] == -127) //If the bottom Ch5 button is pressed...
{
if(SensorValue[armPotentiometer] > 550) //If the Potentiometer
{ //has not reached its minimum point...
motor[port6] = -31; //turn the motor on in reverse.
}
else //If the Potentiometer has reached
{ //its minimum point..
motor[port6] = 0; //turn the motor off.
}
}
}
Limiting Arm Movement with the Potentiometer
This code allows the rotating arm of a robot to be remote controlled using the Ch5 rear
buttons on the Radio Control Transmitter. The Potentiometer is used to prevent the motor
from spinning once the arm has reached its minimum and maximum points.
Go to Reference Links
Vista de página 134
1 2 ... 130 131 132 133 134 135 136 137 138 139 140 ... 165 166

Comentários a estes Manuais

Sem comentários