Go to Post Problem with microprocessors: they do exactly what you tell them to do - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-02-2008, 00:46
aznbadboixx aznbadboixx is offline
Registered User
FRC #1689
 
Join Date: Feb 2008
Location: Bloomfield NJ
Posts: 2
aznbadboixx is an unknown quantity at this point
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);
}
}
}
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 01:00.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi