Hello! I ran into an interesting find today in the motor, SensorValue, and vexRT arrays in robotC. When running this code:
int k=0;
task main()
{
clearDebugStream();
writeDebugStreamLine("c1 %d",Ch1); //0
writeDebugStreamLine("c2 %d",Ch2); //1
writeDebugStreamLine("c3 %d",Ch3); //2
writeDebugStreamLine("c4 %d",Ch4); //3
//4?
//5?
writeDebugStreamLine("c1x %d",Ch1Xmtr2); //6
writeDebugStreamLine("c2x %d",Ch2Xmtr2); //7
writeDebugStreamLine("c3x %d",Ch3Xmtr2); //8
writeDebugStreamLine("c4x %d",Ch4Xmtr2); //9
//10?
//11?
//12?
//13?
writeDebugStreamLine("5d %d",Btn5D); //14
writeDebugStreamLine("5u %d",Btn5U); //15
writeDebugStreamLine("6d %d",Btn6D); //16
writeDebugStreamLine("6u %d",Btn6U); //17
writeDebugStreamLine("8d %d",Btn8D); //18
writeDebugStreamLine("8l %d",Btn8L); //19
writeDebugStreamLine("8u %d",Btn8U); //20
writeDebugStreamLine("8r %d",Btn8R); //21
writeDebugStreamLine("7d %d",Btn7D); //22
writeDebugStreamLine("7l %d",Btn7L); //23
writeDebugStreamLine("7u %d",Btn7U); //24
writeDebugStreamLine("7r %d",Btn7R); //25
writeDebugStreamLine("5dx %d",Btn5DXmtr2); //26
writeDebugStreamLine("5ux %d",Btn5UXmtr2); //27
writeDebugStreamLine("6dx %d",Btn6DXmtr2); //28
writeDebugStreamLine("6ux %d",Btn6UXmtr2); //29
writeDebugStreamLine("8dx %d",Btn8DXmtr2); //30
writeDebugStreamLine("8lx %d",Btn8LXmtr2); //31
writeDebugStreamLine("8ux %d",Btn8UXmtr2); //32
writeDebugStreamLine("8rx %d",Btn8RXmtr2); //33
writeDebugStreamLine("7dx %d",Btn7DXmtr2); //34
writeDebugStreamLine("7lx %d",Btn7LXmtr2); //35
writeDebugStreamLine("7ux %d",Btn7UXmtr2); //36
writeDebugStreamLine("7rx %d",Btn7RXmtr2); //37
writeDebugStreamLine("ax %d",AccelX); //38
writeDebugStreamLine("ay %d",AccelY); //39
writeDebugStreamLine("az %d",AccelZ); //40
writeDebugStreamLine("ax2 %d",AccelXXmtr2); //41
writeDebugStreamLine("ay2 %d",AccelYXmtr2); //42
writeDebugStreamLine("az2 %d",AccelZXmtr2); //43
while(k<36)
{
writeDebugStream("%d",k);
writeDebugStreamLine("motor: %d",motor[k]);
k++;
wait1Msec(1);
}
k=0;
while(k<5000)
{
writeDebugStream("%d",k);
writeDebugStreamLine("SensorValue: %d",SensorValue[k]);
k++;
wait1Msec(1);
}
k=0;
while(k<5000)
{
writeDebugStream("%d",k);
writeDebugStreamLine("vexRT: %d",vexRT[k]);
k++;
wait1Msec(1);
}
while(true)
wait1Msec(50);
}
it gets this result:
c1 0
c2 1
c3 2
c4 3
c1x 6
c2x 7
c3x 8
c4x 9
5d 14
5u 15
6d 16
6u 17
8d 18
8l 19
8u 20
8r 21
7d 22
7l 23
7u 24
7r 25
5dx 26
5ux 27
6dx 28
6ux 29
8dx 30
8lx 31
8ux 32
8rx 33
7dx 34
7lx 35
7ux 36
7rx 37
ax 38
ay 39
az 40
ax2 41
ay2 42
az2 43
0motor: 0
1motor: 0
2motor: 0
3motor: 0
4motor: 0
5motor: 0
6motor: 0
7motor: 0
8motor: 0
9motor: 0
10motor: 0
11motor: 0
12motor: 0
13motor: 0
14motor: 0
15motor: 0
16motor: 0
17motor: 0
18motor: 0
19motor: 0
20motor: 0
21motor: 0
22motor: 0
23motor: 0
24motor: 0
25motor: 0
26motor: 0
27motor: 0
28motor: 0
29motor: 0
30motor: 0
31motor: 0
32motor: 0
33motor: 0
34motor: 0
35motor: 0
//and then 5000 lines of <>SensorValue: 0 and 5000 lines of <>vexRT: 0
- Why is there skips in the vexRT constants between Ch4 and Ch1Xmtr2 and between Ch4Xmtr2 and Btn5D, are there buttons I don’t know about?
- Why is the motor array THIRTY SIX numbers long? Shouldn’t it only be 10 because there is only 10 ports? (trying 36 gets the normal array bounds error)
- Why is the SensorValue array and vexRT arrays’ length not limited to at least double digits? (normal array bounds error is weirdly missing)