View Full Version : Why doesn't this work??!??!!?!!!?!?
HuskieRobotics
04-03-2004, 14:58
I am using the following code to make our robot follow the line but it won't build and i was wondering if anyone could help me out cuz i am frantic...
void User_Autonomous_Code(void)
{
while (autonomous_mode)
{
if (statusflag.NEW_SPI_DATA)
{
Getdata(&rxdata); // bad things will happen if you move or delete this
// Autonomous code goes here.
digital_io_1 = 1;
if(rc_dig_1 ==1 )
{
pwm13 = 137 pwm14=100;
{
else
{
pwm13 = pwm14 = 140;
}
if(rc_dig_2 == 1)
{
pwm13 = 100 pwm = 137;
}
else
{
pwm13 = pwm14 = 140;
}
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); // even more bad things will happen if you mess with this
}
}
}
Thanks!!!!
Could you copy the output from the failed build here? I think your problem is missing a few closing brackets, but it's hard to tell. The output should make it very easy to solve. :)
HuskieRobotics
04-03-2004, 15:12
sure can here it is:
Deleting intermediary files... done.
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "ifi_startup.c" -fo="ifi_startup.o" /i"C:\MCC18\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "ifi_utilities.c" -fo="ifi_utilities.o" /i"C:\MCC18\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "main.c" -fo="main.o" /i"C:\MCC18\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "printf_lib.c" -fo="printf_lib.o" /i"C:\MCC18\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "receiver.c" -fo="receiver.o" /i"C:\MCC18\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "tracker.c" -fo="tracker.o" /i"C:\MCC18\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "user_routines.c" -fo="user_routines.o" /i"C:\MCC18\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "user_routines_fast.c" -fo="user_routines_fast.o" /i"C:\MCC18\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
H:\Working on it\Robot\frc_tracker\user_routines_fast.c:201:Erro r: syntax error
Halting build on first failure as requested.
BUILD FAILED: Thu Mar 04 15:15:45 2004
hope that it will help you to help me!!
Astronouth7303
04-03-2004, 15:12
I am using the following code to make our robot follow the line but it won't build and i was wondering if anyone could help me out cuz i am frantic...
[...]
Thanks!!!!
First, use the [Code] tag.
At line 14, use } instead of { (I asume that was a copy error).
Where is the error? double click it in the build window to see. (line 22, probably)
If you're using the yellow Banner sensors, what wire are you connecting to the FRC? And, compared to the line, are far apart are they?
HuskieRobotics
04-03-2004, 15:16
That was not the error because when i fixed it i still get the same error and i do not know where the error is but i wish that i did!!!!
Mark McLeod
04-03-2004, 15:17
Here are a couple of corrections.
void User_Autonomous_Code(void)
{
while (autonomous_mode)
{
if (statusflag.NEW_SPI_DATA)
{
Getdata(&rxdata); // bad things will happen if you move or delete this
// Autonomous code goes here.
// digital_io_1 = 1; /* Belongs in User_Initialization */
if(rc_dig_in01 ==1 )
{
pwm13 = 137;
pwm14=100;
}
else
{
pwm13 = pwm14 = 140;
}
if(rc_dig_in02 == 1)
{
pwm13 = 100;
pwm14 = 137;
}
else
{
pwm13 = pwm14 = 140;
}
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); // even more bad things will happen if you mess with this
}
}
}
HuskieRobotics
04-03-2004, 15:21
YESSSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!!!
thank you!!!!!!!!!!!!!!!!!!!!!!!!!!
Astronouth7303
04-03-2004, 15:26
That was not the error because when i fixed it i still get the same error and i do not know where the error is but i wish that i did!!!!
Sorry, I'm slow!
Which one? line 14 or 22? and what is it now? (or 13? I just found that)
Also, see the pic for what I mean.
Mark McLeod
04-03-2004, 15:27
YESSSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!!!
thank you!!!!!!!!!!!!!!!!!!!!!!!!!!
Some people are just so easy to please:)
Good luck!
KenWittlief
04-03-2004, 15:42
Engineers are easily amused :^)
Mark McLeod
04-03-2004, 15:45
Engineers are easily amused :^)
Simple minds, simple pleasures;)
deltacoder1020
04-03-2004, 19:09
note - you can put multiple commands on the same line if you want - just make sure you still have a semicolon after each command, just as you would if they were on separate lines. semicolons are not line separators, they are instruction separators.
Astronouth7303
04-03-2004, 19:23
So similarly, Can you put 1 command across multiple lines? I mean with the compiler, not the language.
deltacoder1020
05-03-2004, 00:20
if it's anything like a normal C compiler, you should be able to. no guarantees, though.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.