View Single Post
  #13   Spotlight this post!  
Unread 18-02-2010, 19:27
umangv620 umangv620 is offline
Programming Captain
AKA: Umang
FRC #1403 (Cougar Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2008
Location: New Jersey
Posts: 80
umangv620 will become famous soon enoughumangv620 will become famous soon enough
Re: Help Solenoid Programming

Quote:
Originally Posted by reversed_rocker View Post
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);
This thread is posted in the LabView section. That is def. not labview code.
__________________
Team 1403 Cougar Robotics

2009-2011 Programming Captain

2010
NJ-Regional - Chairmans Award
Reply With Quote