WHAT I AM DOING WRONG?!?!?!??!?
PLEAZE!!!Before I explode!!!
I am not trying to spam but I need answers fast!
Ummm⌠Posting every 2 minutes isnât going to get any answers, and faster⌠Let me see if I canât find an autonomous program real quick.
THanks in advance
This is completely !UNTESTED! code. But I believe it will work. O made a function just to keep my code in order But I will post all code from the included files. BTW, I used the FVC competition template.
main.c
#include "Main.h"
void main ( void )
{
Initialize ( ) ;
Autonomous ( 20 ) ;
OperatorControl ( 254 ) ;
}
Autonomous.c
#include "Main.h"
void Autonomous ( unsigned long ulTime )
{
int bump;
bump = GetDigitalInput ( 1 ) ;
while ( bump == 0 )
{
auto_move ( ) ;
}
if ( bump == 1 )
{
SetPWM ( 1 , 0 ) ;
SetPWM ( 2 , 0 ) ;
Wait ( 1000 ) ;
SetPWM ( 1 , 255 ) ;
SetPWM ( 2 , 0 ) ;
Wait ( 1000 ) ;
SetPWM ( 1 , 200 ) ;
SetPWM ( 2 , 200 ) ;
}
}
auto_move.c (my function)
#include "Main.h"
void auto_move ( void )
{
int time;
SetPWM ( 1 , 200 ) ;
SetPWM ( 2 , 200 ) ;
Wait ( 1500 ) ;
SetPWM ( 1 , 200 ) ;
SetPWM ( 2 , 150 ) ;
Wait ( 1500 ) ;
SetPWM ( 1 , 200 ) ;
SetPWM ( 2 , 200 ) ;
Wait ( 1500 ) ;
SetPWM ( 3 , 255 ) ;
Wait ( 1000 ) ;
SetPWM ( 3 , 127 ) ;
}
Noting fancy just drive straight, drop an arm, stop the arm. If it hits someting bumper switch will trip, it will back up, turn, and try again.
Hi, we had the same problem. Re download the master code to the robot and it should work!
Have fun and remember gracious professionalism
Xavier High School
We fixed it the day before appleton.I think it was because operator control wasnt
in a loop;)
yeah
the whole looping the operator code thing got us confused too
In what way were you confused???
How did you think it was to work??? I would like to âlearnâ how you âperceivedâ the Vex Controller works, so that I can try to explain programming better to othersâŚ
I donât quite understand why you have to put everything in a while loop either but then that may just be because Iâm used to java not c.
I am not quiet sure about Java, but âCâ and âC++â, and all the other languages I have worked with have a Definitive Starting place (for âCâ it is the âmainâ function starting right after the Opening Brace) and a Definitive End place (for âCâ it is the Ending Brace of the âmainâ function).
IF you donât want your Program to end, you must never let you program reach the Ending Brace. With every Embedded System I have worked with (about 50 different programs in 12 different Hardware environments) After the Initialization of the Variables at the Top of the âmainâ function, there is a âwhile(1)â that keeps ALL the rest of the code running, forever, until a power loss or crash.
Does the Parent process of Java, keep calling your Java Program?? How do you Terminate your Java Program when you are done???
Java is not different from other common languages in this respect. All languages boil down to assembly-level (and more detailed) instructions.
If the instructions given to the CPU donât tell it to follow a branch to run some of the instructions continuously, then inevitably, practially speaking, the program will finish and the computer will sit like a lump until it is given new instructions. With perhaps a few exotic exceptions (none come to mind) this isnât a function of the language; instead it is implicit in the way we build computers and, fundamentally, in the way the universe works.
Blake
With Java at the level Iâm at we use a main which will call other methods or functions. The main wonât necessarily keep executing forever but you can make it do that.
That is the same with âCâ and âC++â.
EasyC 1.x is a little diffucult to call function (methods), but it can be done, thus most all the Code is done in-line⌠A âwhileâ loop is still needed to keep the Vex Controller processing your User Input and keep sending commands to the motorsâŚ