Vex CORTEX Manuel d'instructions Page 135

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 166
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
Vue de la page 134
1 2 ... 130 131 132 133 134 135 136 137 138 139 140 ... 165 166

Commentaires sur ces manuels

Pas de commentaire