Tips and Tricks

The Beginners Guide to RobotC

A few months ago I started on a guide for programming VEX robots with RobotC, partly to help me refresh my memory over time, and also to help teach people new to RobotC. Originally this was going to cover the whole of RobotC, but I realised later that it would be way too long! So instead I have started a series of guides for RobotC.

The first one, The Beginners Guide to RobotC is now at a publishable state and so I have uploaded it to the website.

You can find the guide here.

Velcro as battery straps

Vex one-wrap velcro makes a great alternative to the plastic battery straps. Velcro is a lot easier to use when in a hurry. Just cut a short length, fold it in half and then cut out a V with side cutters. Use a washer to avoid the velcro pulling off.

Vex tilt sensor

Want a tilt sensor thats legal in the Vex Robotics Competitions? You can use an accelerometer as a tilt sensor. There will always be a 1g downwards force on the accelerometer, so you just have to find how much force there is on 1 or 2 axes. One axis will give you 180 degrees of rotation, while 2 axes will give you a full 360 degrees.

RobotC timeout bug

There is a known bug when using RobotC with crystals. When playing a competition plugged into a field controller, the robot will time out 2 or 3 seconds to early. This has been tested with RobotC versions 1.4 and 2.0.1. To fix the problem, replace
#pragma userControlDuration(120)
with
#pragma userControlDuration(255)
The robot will still stop at the end of the game, as the field controler will disable the transmitter.

This is only for crystals. VEXnet does not have this problem and you can remove the user control duration and autonomous duration lines altogether

More Articles...

Hot Tips