ROBOTC.net forums
http://robotc.net/forums/

No/erroneous readout from channels 3, 4, 5
http://robotc.net/forums/viewtopic.php?f=11&t=8082
Page 1 of 1

Author:  eheinricher [ Thu Feb 27, 2014 1:32 pm ]
Post subject:  No/erroneous readout from channels 3, 4, 5

After noticing some bad behavior from our motors I decided to test our joystick channels by printing their value out to the LCD. Only channel 1 gives me a reading of -127 to 127. Channel 2 gives me readings between 20 and 40. Channels 3 and 4 give no reading at all. I have uploaded the firmware for the cortex and the joystick and calibrated the joystick. I am testing over two different cortexs and two joysticks. Any ideas why our joysticks are not being recognized? Here is my code. Thanks for any help you can offer.

#pragma config(Motor, port2, rightMotor, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port3, leftMotor, tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{

while(true)
{

if (vexRT[Btn5U] == 1)
{
clearLCDLine(0);
displayLCDString(0,0,"B5U");
}
else if (vexRT[Btn5D])
{
clearLCDLine(0);
displayLCDString(0,0,"B5D");
}
else if (vexRT[Btn6U] == 1)
{
clearLCDLine(0);
displayLCDString(0,0,"B6U");
}
else if (vexRT[Btn6D])
{
clearLCDLine(0);
displayLCDString(0,0,"B6D");
}
else if (vexRT[Btn7U] == 1)
{
clearLCDLine(0);
displayLCDString(0,0,"B7U");
}
else if (vexRT[Btn7D])
{
clearLCDLine(0);
displayLCDString(0,0,"B7D");
}
else if (vexRT[Btn7L] == 1)
{
clearLCDLine(0);
displayLCDString(0,0,"B7L");
}
else if (vexRT[Btn7R])
{
clearLCDLine(0);
displayLCDString(0,0,"B7R");
}
else if (vexRT[Btn8U] == 1)
{
clearLCDLine(0);
displayLCDString(0,0,"B8U");
}
else if (vexRT[Btn8D])
{
clearLCDLine(0);
displayLCDString(0,0,"B8D");
}
else if (vexRT[Btn8L] == 1)
{
clearLCDLine(0);
displayLCDString(0,0,"B8L");
}
else if (vexRT[Btn8R])
{
clearLCDLine(0);
displayLCDString(0,0,"B8R");
}
else if (vexRT[Ch1])
{
clearLCDLine(0);
displayLCDNumber(0,0,vexRT[Ch1]);
}
else if (vexRT[Ch2])
{
clearLCDLine(0);
displayLCDNumber(0,0,vexRT[Ch2]);
}
else if (vexRT[Ch3])
{
clearLCDLine(0);
displayLCDNumber(0,0,vexRT[Ch3]);
}
else if (vexRT[Ch4])
{
clearLCDLine(0);
displayLCDNumber(0,0,vexRT[Ch4]);
}
else
{
clearLCDLine(0);
displayLCDString(0,0,"None");
}
}
}

Author:  eheinricher [ Thu Feb 27, 2014 1:43 pm ]
Post subject:  Re: No/erroneous readout from channels 3, 4, 5

Totally just realized I forgot to do vexRT[Ch1] != 0 for my conditionals. This might help.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/