View unanswered posts | View active topics It is currently Wed Jul 23, 2014 6:14 pm






Reply to topic  [ 5 posts ] 
vex double soleniod program help 
Author Message
Rookie

Joined: Mon Jan 31, 2011 11:41 pm
Posts: 5
Post vex double soleniod program help
Could someone please check my code and tell me why it only works one valve and not the other? I assume that there needs to be a +/- signal sent from digital 7 for the 2 valves. we have the cortex and newest robotc

Code:
#pragma config(Sensor, dgtl7,  soleniod1,           sensorDigitalOut)
#pragma config(Sensor, dgtl8,  soleniod2,           sensorDigitalOut)
#pragma config(Sensor, dgtl9,  solenoid3,           sensorDigitalOut)
#pragma config(Motor,  port2,           right,         tmotorNormal, openLoop)
#pragma config(Motor,  port3,           left,          tmotorNormal, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main ()
{
while(true)                   // Loop Forever

if(vexRT[Btn6U] == 1)           // If button 6U (upper right shoulder button) is pressed:
{
SensorValue[soleniod1] = 1;  // …activate the solenoid.
}
else // If button 6 (upper right shoulder button) is  NOT pressed:
{
SensorValue[soleniod1] = 0;  // ..deactivate the solenoid.
}

if(vexRT[Btn6D] == 1)           // If button 6U (upper right shoulder button) is pressed:
{
SensorValue[soleniod1] = -1;  // …activate the solenoid.
}
else // If button 6 (upper right shoulder button) is  NOT pressed:
{
SensorValue[soleniod1] = 0;  // ..deactivate the solenoid.
}

}


Mon Jan 31, 2011 11:58 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: vex double soleniod program help
In both sections you are activating solenoid1. Is it supposed to activate solenoid2 or 3?

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Feb 01, 2011 2:07 am
Profile WWW
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post Re: vex double soleniod program help
Yes, it looks like you're trying to control the same physical solenoid in both pieces of code. Also, since solenoids are digital outs, you only ever have to give them values of 1 or 0 (no negatives).

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Tue Feb 01, 2011 10:15 am
Profile
Rookie

Joined: Mon Jan 31, 2011 11:41 pm
Posts: 5
Post Re: vex double soleniod program help
There is no other way to connect a double seloniod. It is a 3 wire that only goes in one digital slot. The documentation is non existant. I guess I will look for the soleniod on line but I can not imaginge a way to activate both valves with out +/-. the digital can do negatives with the motors. Do I need to assign a motor to the port and through code limit it to 5 volts?
thanks


Tue Feb 01, 2011 11:17 am
Profile
Rookie

Joined: Mon Jan 31, 2011 11:41 pm
Posts: 5
Post Re: vex double soleniod program help
http://www.coastpneumatics.com/american ... valves.pdf
shows the syj3120 as definately +/- voltage controled by diodes.


Tue Feb 01, 2011 11:58 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.