|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Piston Help in RobotC
I'm having trouble programming the solenoid to extend the piston. I have a piston connected to a SMC solenoid to a spike. The spike in in relay port 2. Here is my code. I try a lot of different code but none of them do anything. Any help will be greatly appreciated. Thanx
#include "FRC_Comp_Include.c" #pragma platform(FRC) #include "pneumaticCompressorDriver.c" void Initialization() { bMotorReflected[port2] = true; //Flipping the motor (since the motors are opposing) frcDigitalIODirection[pio1] = dirOutput; // which says turn digital IO port 3 into an output port } task Autonomous() { motor[port1] = 64; motor[port2] = 64; wait1Msec(5000); motor[port1] = 40; motor[port2] = -40; wait1Msec(3000); motor[port1] = 64; motor[port2] = 64; wait1Msec(5000); motor[port1] = -40; motor[port2] = 40; } task Human_Control() { while(true) { motor[port1] = frcRF[p1_y]; motor[port2] = frcRF[p2_y]; while(frcOIJoystickButtons[oiButtonPort3Button3] == 1) // { frcRelay[relay1] = relayFwd; // turn on compressor //frcRelay[relay1] = relayOff; turn off } while(frcOIJoystickButtons[oiButtonPort3Button4] == 1) // { frcRelay[relay1] = relayOff; // turn on compressor //frcRelay[relay1] = relayOff; turn off } while(frcOIJoystickButtons[oiButtonPort3Button1] == 1) // piston { frcRelay[relay2Fwd] = true;// frcRelay[relay2Rvs] = false; } while(frcOIJoystickButtons[oiButtonPort3Button2] == 1) //piston { frcRelay[relay2]=relayRvs; // //frcRelay[relay1] = relayOff; turn off } /* while(frcOIJoystickButtons[oiButtonPort3Button1] == 1) //bottom left button { frcDigitalIOValue[pio1] = true; //to turn the output on (activate the solenoid) //frcDigitalIOValue[pio3] = 0; turn off } while(frcOIJoystickButtons[oiButtonPort3Button2] == 1) //bottom left button { frcDigitalIOValue[pio1] = false; } */ while(frcOIJoystickButtons[oiButtonPort1Button3] == 1) //top left button { // motor[port1] = -25; // motor[port2] = -25; //wait1Msec(10); } while(frcOIJoystickButtons[oiButtonPort1Button4] == 1) //top right button { // motor[port1] = -50; //motor[port2] = -50; //wait1Msec(10); } // // Start the compressor device driver. This task will manage the compressor pump. // const TFRCRelay16 kValveID = relay1Rvs; StartTask(pneumaticCompressorDriver); while (true) { // // Here's where you'd write your main code. For now, this is just a simple program // that will turn a pneumatic value ("kValveID") on and off // frcRelay16[kValveID] = true; wait1Msec(400); frcRelay16[kValveID] = false; wait1Msec(400); } } } |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ROBOTC help | Shivang1923 | Programming | 3 | 09-02-2008 13:19 |
| Setting up an analog input in RobotC for IFI. | NSolarz | Programming | 2 | 30-01-2008 20:23 |
| ROBOTC - Controller | ShawnHanna | Programming | 1 | 30-01-2008 20:20 |
| need some help with piston | coolguybigt | Chit-Chat | 1 | 03-04-2007 15:22 |
| Congrats to the Robotc Knights! | MattB703 | Thanks and/or Congrats | 0 | 18-03-2002 15:07 |