My class is using RobotC 1.08 on computers running Windows XP. One of the students squarebot w/ PIC will only run while it is connected to the computer. This problem persists on more then one computer. We tried reloading the firmware, but no difference.

The robot has a sonar sensor on the front. The goal is to drive forward to within 5 inches from a barrier, turn 180 degrees,and then return to the starting area until another barrier is detected and stop. Would you like to see the code? The students have left but I could rewrite it myself.

Try going to Robot > VEX Cortex Download Method, and choosing "Download using USB Only". Then redownload your program, and turn the robot off and back on. Your program should then immediately run any time you turn the robot on.

Sonar sensors return a value of -1 when they don't get a sound echo. Sound takes time to travel, so for the first fraction of a second of any program, the sensor value will be -1 until the sensor gets a sound echo.

If the first thing in your program happens to be something along the lines of...

while(SensorValue[sonar] > 5){}

...this condition will never be met, since it will have a value of -1. If this is the problem, you can fix the condition or put a brief wait statement at the beginning. If you go here: http://www.robotc.net/vex_full/ to the Sensing > Ultrasonic section, you'll find some tutorials that might help.

Sonar sensors return a value of -1 when they don't get a sound echo. Sound takes time to travel, so for the first fraction of a second of any program, the sensor value will be -1 until the sensor gets a sound echo.

Yes we realized this last week, the sonar was not working till we made this change. Here is the code we are using.

While hooked to the computer, the program runs well. First the time delay, then the first while loop until we trigger the sensor, then the turn, then the last while loop. When off the computer it just does the "wait1Msec(2000);" and the turn.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum