|
Page 1 of 1
|
[ 2 posts ] |
|
**Error**:Executable statements not valid in 'main' declarat
| Author |
Message |
|
Dillonsimeone
Rookie
Joined: Tue Jan 22, 2013 8:49 pm Posts: 1
|
 **Error**:Executable statements not valid in 'main' declarat
I'm baffled at this problem. I'm getting a **Error**:Executable statements not valid in 'main' declaration block at line 66 (Last line) No matter what I rip out and shove in, it keep screaming error[Something]. I'm at the point where I'm starting to think that when a error window will pop up, "Error: No errors found"  |  |  |  | Code: #pragma config(Hubs, S1, HTMotor, none, none, none) #pragma config(Hubs, S2, HTMotor, none, none, none) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Sensor, S2, , sensorI2CMuxController) #pragma config(Motor, motorA, LifterL, tmotorNormal, PIDControl, encoder) #pragma config(Motor, motorB, LifterR, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C1_1, motorBL, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C1_2, motorBR, tmotorNormal, openLoop) #pragma config(Motor, mtr_S2_C1_1, motorFL, tmotorNormal, openLoop) #pragma config(Motor, mtr_S2_C1_2, motorFR, tmotorNormal, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "joystickDriver.c" //loads up the programs for the controller!
void initializeRobot() //No clue why this is needed. To ensure the robot don't explode, I guess.
{ return; }
task main() { initializeRobot();
waitForStart(); }
while(true)//Loop dat stuff {
getJoystickSettings(joystick);//Fire up the joycontroller program!
motor[motorBL]= joystick.joy1_y1;
motor[motorBR]= joystick.joy1_y2;
motor[motorFL]= joystick.joy1_y1;
motor[motorFR]= joystick.joy1_y2;
if(joystick.joy1_TopHat == 0) // If the topmost button on joy1's D-Pad ('TopHat') is pressed: { motor[LifterL] = 50; // LifterL is run at a power level of 50. }
if(joystick.joy1_TopHat == 0) { motor[LifterR] = 50; }
if(joystick.joy1_TopHat == 4) // If the belowmost button on joy1's D-Pad ('TopHat') is pressed: { motor[LifterL] = -50; }
if(joystick.joy1_TopHat == 4) { motor[LifterR] = -50; } }
|  |  |  |  |
|
| Tue Jan 22, 2013 9:01 pm |
|
 |
|
amcerbu
Novice
Joined: Sun Oct 21, 2012 10:01 pm Posts: 76
|
 Re: **Error**:Executable statements not valid in 'main' decl
Did you mean to place a close bracket after waitForStart();? From the while (true) loop to the end, the code isn't inside any function. The initializeRobot() function is called to put servos in their starting positions and calibrate sensors. The function is called before the beginning of the actual autonomous period (since it's before waitForStart()). See if this works out better for you:  |  |  |  | Code: #pragma config(Hubs, S1, HTMotor, none, none, none) #pragma config(Hubs, S2, HTMotor, none, none, none) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Sensor, S2, , sensorI2CMuxController) #pragma config(Motor, motorA, LifterL, tmotorNormal, PIDControl, encoder) #pragma config(Motor, motorB, LifterR, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C1_1, motorBL, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C1_2, motorBR, tmotorNormal, openLoop) #pragma config(Motor, mtr_S2_C1_1, motorFL, tmotorNormal, openLoop) #pragma config(Motor, mtr_S2_C1_2, motorFR, tmotorNormal, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c" // loads up the programs for the controller!
void initializeRobot() { return; }
task main() { initializeRobot(); waitForStart(); while(true) // Loop dat stuff { getJoystickSettings(joystick); // Get newest joystick messages motor[motorBL]= joystick.joy1_y1; motor[motorBR]= joystick.joy1_y2; motor[motorFL]= joystick.joy1_y1; motor[motorFR]= joystick.joy1_y2; if(joystick.joy1_TopHat == 0) // If the topmost button on joy1's D-Pad ('TopHat') is pressed: { motor[LifterL] = 50; // LifterL is run at a power level of 50. } if(joystick.joy1_TopHat == 0) { motor[LifterR] = 50; } if(joystick.joy1_TopHat == 4) // If the bottommost button on joy1's D-Pad ('TopHat') is pressed: { motor[LifterL] = -50; } if(joystick.joy1_TopHat == 4) { motor[LifterR] = -50; } } }
|  |  |  |  |
|
| Tue Jan 22, 2013 10:39 pm |
|
|
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|