Hello. ive been trying to create a tank drive arm robot for a while. im on version 8.0 now and its a two motor drive train with one claw motor, one arm lift motor, two vex flashlights, and two aditional motors for the arm. however, i am trying to make it so there is also an indicator sensor led that will blink if the arm is up. to do this i thought i could use a code that links to a potentiometer, saying that if the potentiometer is above 50, the indicator will begin a blink cycle. however, when i did this, it formed multiple problems. if the drive motors were running when the potentiometer went above the selected level, the motors would run without any joystick control response. and if the motors were not running when the potentiometer went to the selected level, the drive would be locked at 0. furthermore, i was using a light sensor to opperate the flashlights as an almost “auto-headlight” system. however, the potentiometer would lock that out as well, as it did with the motors. could i get some help writing a code so that the indicator will flash if the potentiometer is above 50, as well as the lights turn on if the light sensor detects less than 700, without having any sensor interfere with the motors or responsiveness to the joystick controller? i have the file i was working on, the one that i keep having trouble with.
#pragma config(Sensor, in1, , sensorReflection)
#pragma config(Sensor, in2, , sensorPotentiometer)
#pragma config(Sensor, dgtl1, , sensorLEDtoVCC)
#pragma config(Motor, port2, , tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port3, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, , tmotorVexFlashlight, openLoop, reversed)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
task main()
{
while(1==1)
{
motor[port2] = vexRT[Ch3]; // Left Joystick Y value
motor[port3] = vexRT[Ch2]; // Right Joystick Y value
{
if(SensorValue[in1] > 700)
motor[port4] = 127 ;
else
motor[port4] = 0 ;
{
if(SensorValue[in2] > 500)
{
SensorValue[dgtl1] = 1;
wait1Msec(1000);
SensorValue[dgtl1] = 0;
wait1Msec(1000);
}
}
}
}
}