View Single Post
  #9   Spotlight this post!  
Unread 19-02-2004, 09:17
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Pneumatics Programming

Quote:
Originally Posted by Astronouth7303
Yes, That is simlest.

Our idea was using a pot for 'Target' position and using a sensor with 2 solenoids to make it stop.
Like:
Code:
Const Arm_Upper_Stop as Unsigned Int = 150
const Arm Upper_Catch as unsigned int = 140
Const Arm_Upper_Range as Unsigned Int = 130
Const Arm_Target as Unsigned Int = 125
Const Arm_Lower_Range as Unsigned Int = 120
const Arm_Lower_Catch as Unsigned Int = 110
Const Arm_Lower_Stop as Unsigned Int = 100

void inter_ArmSensor(void)
{
 Static iPrevValue as unsigned int
 
 //Continue after catchup
 if (iPrevValue >= Arm_Upper_Stop & ArmSensor < Arm_Upper_Catch)
  {ArmMotor_Go;}
 if (iPrevValue <= Arm_Lower_Stop & ArmSensor > Arm_Lower_Catch)
  {ArmMotor_Go;}
 
 //Emergancy Stops
 if (ArmSensor >= Arm_Upper_Stop)
  {ArmMotor_Stop;}
 if (ArmSensor <= Arm_Lower_Stop)
  {ArmMotor_Stop:}
 
 //Start Cylinder
 if (ArmSensor >= Arm_Upper_Range)
  {ArmCylinder_Out;}
 if (ArmSensor <= Arm_Lower_Range)
  {ArmCylinder_In;}
 
 //Stop Cylinder
 if (ArmSensor < Arm_Upper_Range)
  {ArmCylinder_Stop;}
 if (ArmSensor > Arm_Lower_Range)
  {ArmCylinder_Stop;}
}
But I have a more efficient idea.
If anyone uses that make sure to change the Consts to lowercase. (Horrible error, Astronouth. )
__________________