ROBOTC Programming Question

I am new at programming with ROBOTC so just keep up on this with me please.

What is the command for ROBOTC that will let your robot keep moving with the momentom it already has, not stop when the time is up.

Typed On Nook
Forgive Typos

Thanks!

If you’re in a competition, then this is not allowed. If you’re programming for your own purposes outside of competition, then just don’t put your code in the competition template. When a match finishes, there is nothing in the code that makes the robot brake. The motors just stop moving, and friction within them and in your robot stops the robot.

OK, here is another question.

So I think there are commands that are in ROBOTC such as this:

That makes the robot move forward on full power for 2 sec.
What are other commands for sensors. How do I use them and such.

Thanks!

ROBOTC comes with about 50 example programs that cover all the sensors available. Best thing is to try some of the examples and then ask specific questions about things you don’t understand.

I would also recommend watching the webinars on the ROBOTC website: http://www.robotc.net/education/webinars/

The robot will keep driving with the momentum it already has when you give it’s speed value as “0” unless you make it brake (which can be done by quickly making the motors drive in the opposite direction. At least this is my understanding

For example, the first code example will make the motors drive for 2 seconds, then stop. The motors will continue to spin with the momentum it has. The second example will make it brake after 2 seconds.

Example 1:


task main()
{
motor[port1] = 127;
motor[port2] = 127;
wait1msec(2000);
motor[port1] = 0;
motor[port2] = 0;
}

Example 2:


task main()
{
motor[port1] = 127;
motor[port2] = 127;
wait1msec(2000);
motor[port1] = -10;//will probably need tweaking
motor[port2] = -10;//will probably need tweaking
wait1msec(500);//will probably need tweaking
motor[port1] = 0;
motor[port2] = 0;
}

Does this answer your question?

Also, have a look through my Beginners Guide to ROBOTC, you may find it useful.

~George