View Single Post
  #3   Spotlight this post!  
Unread 18-02-2010, 18:07
reversed_rocker's Avatar
reversed_rocker reversed_rocker is offline
Alumni
AKA: Ken Condon
FRC #0706 (Cyberhawks)
Team Role: College Student
 
Join Date: Nov 2008
Rookie Year: 2008
Location: Hartland
Posts: 69
reversed_rocker is on a distinguished road
Re: Help Solenoid Programming

solenoids are programmed a little differently that the drive, joysticks, analog inputs, or digital inputs that you're used to so i'll just write the code you need to initialize it and then give you an example of how to let air in and how to let air out. I'm going to assume that you're using the simple robot template, if you arent this code will still work but it will be placed in a different part of your code


//defines the pointers as part of the solenoid class, goes in class RobotDemo: public Simple Robot {

Solenoid *kicker_kick;
Solenoid *kicker_return;

//initializes solenoids and gives them a channel on the relay section of the IO board goes in RobotDemo(void):

kicker_kick = new Solenoid(1);
kicker_return = new Solenoid(2);

//pushes the kicker out, remember not to let the two sides of the solenoid fight each other, goes into the while(IsOperatorControl()) {

kicker_return->Set(false);
kicker_kick->Set(true);

//pulls the kicker back in
kicker_kick->Set(false);
kicker_return->Set(true);
Reply With Quote