I’m completely new to RobotC and I have a stupid question: can you use decimal point values in variables, like below:
motor[one] = 63.5;
motor[two]= 63.5;
motor[nine] = 63.5;
motor[ten] = 63.5;
Also, I’m a bit confused in regards to where exactly you put your autonomous in the program. I have commented out an alternative one for scoring a mobile goal and stuff, but I’m just looking for why exactly these errors are popping up:
*Warning*:Meaningless statement -- no code generated
*Warning*:Missing ';' has been automatically inserted by compiler
**Error**:Internal Compiler: Unexpected use of proc 'wait1Msec' in an expression
**Error**:Procedure 'wait1Msec' is invalid syntax at this point
**Error**:LValue for ']' operator must be a pointer
*Warning*:Meaningless statement -- no code generated
*Warning*:';' expected before '}'. Automatically inserted by compiler
And here is the code:
void pre_auton()
{
motor[claw] = 0; //makes sure it is all the way down if we are using MG auton
motor[three] = 0; //same as above but for lift
motor[four] = 0;
motor[five] = 0;
motor[six] = 0;
}
task autonomous //for scoring on stationary goal in front of robot
{
motor[one] = 63.5; // moves toward goal
motor[two]= 63.5;
motor[nine] = 63.5;
motor[ten] = 63.5;
wait1Msec[1000]; // duration of time for which it moves forward
motor[claw] = 127 //keeps holding preload
motor[three] = 127; // lift lifts to top capacity
motor[four] = 127;
motor[five] = 127;
motor[six] = 127;
wait1Msec[5000]; // does everything above for 5 seconds
motor[claw] = -127 // claw release
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//auton for turning right and scoring cone on mobile goal...using point turn vs. swing turn to be more precise //
/////////////////////////////////////////////////////////////////////////////////
//task autonomous //for scoring on stationary goal in front of robot
//{
// motor[ten] = 67; // turns to exact angle facing goal
// motor[claw] = 100; // keeps hold on preload
// wait1Msec[1000];
// motor[claw] = 100; // keeps hold on preload
// motor[one] = 127; // moves toward goal
// motor[two]= 127;
// motor[nine] = 127;
// motor[ten] = 127;
//insert positioning here for turning of chassis motors
// wait1Msec[2500];
// motor[claw] = 100; // keeps hold on preload
// motor[three] = 67;
// motor[four] = 67;
// motor[five] = 67;
// motor[six] = 67;
// wait1Msec[2500];
// motor[claw] = -100;
//}
///////////////////////////////////////
#pragma config(Motor, port1, one, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, two, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, three, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port4, four, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, five, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, six, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port7, claw, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, nine, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, ten, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
while (true)
{
motor[port1] = vexRT(Ch3);
motor[port2] = vexRT(Ch3);
motor[port9]= vexRT(Ch2);
motor[port10] = vexRT(Ch2);
motor[port3] = vexRT(Btn6U)*127 - vexRT(Btn6D) *127;
motor[port4] = vexRT(Btn6U) *127 - vexRT(Btn6D) *127;
motor[port5] = vexRT(Btn6U) *127 - vexRT(Btn6D) *127;
motor[port6] = vexRT(Btn6U) *127 - vexRT(Btn6D) *127;
motor[port7] = vexRT(Btn5U) *127 - vexRT(Btn5D) *127;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
It’s kind of a giant mess, and I’ve done my best to point out my intentions in parts of this with comments. If anyone has the slightest idea what’s going on with these errors or knows where to put each section of the code (which I suspect is causing some of them) that would be awesome. I’m pretty sure I screwed up with some of the commands and variables. Thanks!