Programming Help!!?!

Looking for anyone who can help me! I’m head of building and design for my team and my programer left. I know how to do the general programming of the motors but we have Vex’s double acting pneumatic pistons and I can’t get them to work, PLEASE HELP, WE HAVE A COMPETITION IN A FEW DAYS!!! We are using easy c.

I’ve moved this thread to the general tech support channel.

1 Like

Can you be a bit more specific on what you are trying to do?

I have never use pneumatic pistons in easyC but I know from RobotC all you need is to set the piston to a digital out port and set it to 1 if you want to piston to engage and 0 if you want it to disengage.


SensorValue[piston] = 0 //disengage
SensorValue[piston] = 1 //engages

You can go here to for a good guide on how to program the pistons. It is for RobotC but I think it would be relatively easy to transfer over to EasyC

@DaxLoy Sometimes there’s a factory screwup and 0 engages, and 1 disengages. My team spent 2 hours trying to figure out how to use double acting pneumatics until we realized that the engaging/disengaging was reversed.

I really don’t think that the factory messed it up.(SMC has higher quality control than VEX) The solenoid has 2 outputs and you arrange them into whichever end of the piston you would like.

guys, I wrote Madbagpiper7816 a pm with the code he needed.

@antichamber, post it here so teams that have this problem in the future can use it to

#pragma config(Sensor, dgtl1,  piston_a,       sensorDigitalOut)
#pragma config(Sensor, dgtl2,  piston_b,       sensorDigitalOut)
#pragma config(Sensor, dgtl3,  piston_c,       sensorDigitalOut)
#pragma config(Sensor, dgtl4,  piston_d,       sensorDigitalOut)
#pragma config(Sensor, dgtl5,  button,         sensorDigitalIn)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//


// Hello Madbagpiper7816! this is a program that will control your VEX EDR robot. Please read all the text with a "//" before it

#pragma platform(VEX2)
#pragma competitionControl(Competition)!
#include "Vex_Competition_Includes.c"
//=================================================================-DEFINED STUFF-===============================================================
#define left_motor_a port0					//change the zero to the number that corrisponds to a motor port you plugged in a drivetrain motor into on the left side
#define left_motor_b port0					//change the zero to the number that corrisponds to a motor port you plugged in a drivetrain motor into on the left side
#define right_motor_a port0 				//change the zero to the number that corrisponds to a motor port you plugged in a drivetrain motor into on the right side
#define right_motor_b port0 				//change the zero to the number that corrisponds to a motor port you plugged in a drivetrain motor into on the right side
#define	arm_motor_left_a port0 			//change the zero to the number that corrisponds to a motor port you plugged in a arm motor into on the left side
#define	arm_motor_left_b port0 			//change the zero to the number that corrisponds to a motor port you plugged in a arm motor into on the left side
#define	arm_motor_left_c port0 			//change the zero to the number that corrisponds to a motor port you plugged in a arm motor into on the left side
#define	arm_motor_right_a port0 		//change the zero to the number that corrisponds to a motor port you plugged in a arm motor into on the right side
#define	arm_motor_right_b port0 		//change the zero to the number that corrisponds to a motor port you plugged in a arm motor into on the right side
#define arm_motor_right_c port0 		//change the zero to the number that corrisponds to a motor port you plugged in a arm motor into on the right side

//=================================================================-PRE-AUTON-====================================================================
void pre_auton()
{

	bStopTasksBetweenModes = true;
}

//=================================================================-AUTONOMOUS-====================================================================
task autonomous()
{


	AutonomousCodePlaceholderForTesting();							///I haven't made a autotomous for this, sorry
}

//=================================================================-USER-CONTROL-====================================================================
task usercontrol()
{
	while (true)
	{
		wait1msec(20);
		motor[left_motor_a] = vexRT[Ch2];
		motor[left_motor_b] = vexRT[Ch2];
		motor[right_motor_a] = 0 - vexRT[Ch3];
		motor[right_motor_b] = 0 - vexRT[Ch3];
		if(vexRT[Btn6u] == 1){
			motor[arm_motor_left_a] = 127;
			motor[arm_motor_left_b] = 127;
			motor[arm_motor_left_c] = 127;
			motor[arm_motor_right_a] = -127;
			motor[arm_motor_right_b] = -127;
			motor[arm_motor_right_c] = -127;
			}else if(vexRT[Btn6d == 1){
			motor[arm_motor_left_a] = 0;
			motor[arm_motor_left_b] = -127;
			motor[arm_motor_left_c] = -127;
			motor[arm_motor_right_a] = 127;
			motor[arm_motor_right_b] = 127;
			motor[arm_motor_right_c] = 127;
			}else{
			motor[arm_motor_left_a] = 0;
			motor[arm_motor_left_b] = 0;
			motor[arm_motor_left_c] = 0;
			motor[arm_motor_right_a] = 0;
			motor[arm_motor_right_b] = 0;
			motor[arm_motor_right_c] = 0;
		}
		if(vexRT[Btn5u] == 1){
			SensorValue[piston_a] = 1;
			SensorValue[piston_b] = 1;
			SensorValue[piston_c] = 1;
			}else{
			SensorValue[piston_a] = 0;
			SensorValue[piston_b] = 0;
			SensorValue[piston_c] = 0;
		}
	}
}

posted image is proof that It helped

Is there a reason you don’t use the built in motor and sensor setup? Your code is a lot harder to read

motor[arm_motor_left_c] = -127;
			motor[arm_motor_right_a] = 127;

This is hard to read because it expects the user to know which direction for each motor runs the lift. Instead of using the reverse flag on the motors that are inverted.

I hadn’t used robotC in a while