 | Quote: #pragma config(Hubs, S1, HTMotor, HTMotor, HTServo, HTMotor) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Motor, mtr_S1_C1_1, ScissorRight, tmotorNormal, openLoop, reversed) #pragma config(Motor, mtr_S1_C1_2, ScissorLeft, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C2_1, ArmGrab, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C2_2, ArmLift, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C4_1, DriveRight, tmotorNormal, openLoop, reversed) #pragma config(Motor, mtr_S1_C4_2, DriveLeft, tmotorNormal, openLoop) #pragma config(Servo, srvo_S1_C3_1, SpinRight, tServoContinuousRotation) #pragma config(Servo, srvo_S1_C3_2, SpinLeft, tServoContinuousRotation) #pragma config(Servo, srvo_S1_C3_3, servo3, tServoNone) #pragma config(Servo, srvo_S1_C3_4, servo4, tServoNone) #pragma config(Servo, srvo_S1_C3_5, servo5, tServoNone) #pragma config(Servo, srvo_S1_C3_6, servo6, tServoNone) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
task main() { nMotorEncoderTarget[ArmLift] = 0; //Set encoder value to 0
while(true) { getJoystickSettings(joystick); /////////////////////////////////////////////////////////////////////////////////////
if(joystick.joy1_TopHat == 4) //When the POV down is pressed lower arm { motor[ArmLift] = -100; wait1Msec(400); motor[ArmLift] = 5; wait1Msec(100); motor[ArmLift] = 0; } else // If it isn't pressed, don't do anything. { motor[ArmLift] = 0; }
if (joystick.joy1_TopHat == 0) //When POV down is pressed raise arm { nMotorEncoderTarget[ArmLift] = 600; motor[ArmLift] = 50; while(nMotorEncoder[ArmLift] <600){} } else // If it isn't pressed, don't do anything. { motor[ArmLift] = 0; }
////////////////////////////////////////////////////////////////////////////////////////////////////// } }
|  |