![]() |
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); } } } |
| All times are GMT -5. The time now is 01:00. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi