RobotC Sensor Tutorials

Does anyone know or have any good tutorials for programming sensors in RobotC? I’m looking for help programming the following sensors:
-Integrated Motor Encoder
-Ultrasonic Range Finder


Probably the best two sources I can think of right off the bat are the built-in help menu and our wiki (which is a work in progress). They’ll give you straight coding examples. Another good source of info is the Robotics Academy, they have more in-depth tutorials and videos for each sensor.

Robotics Academy: [

For the Robotics Academy, you’ll want to head to the High School->VEX CORTEX video trainer to get started. From there, to get specifically to the shaft encoder/pot/sonar videos, you’ll want to navigate to:

Motor Encoders = Movement->Shaft Encoders
Sonar = Sensing->Forward until Near
Potentiometer = I don’t think we have any tutorials specifically for the Potentiometer, but it’s a 0-4095 value depending on the wiper’s rotational location.

If you see anything missing on the Wiki or anything you would like to see added, please let me know, we are constantly looking for ways to improve upon it! And as always, if you have any specific questions, don’t be afraid to ask, we’re here to help.](

All of the sensors are going to give you a variable number, what you decide to do with that number is where the programming comes in. It’s hard to give generic examples, although there are some aimed at specific problems on the forum. Here is one using a quadrature encoder as part of a PID control loop, probably not the best example for a beginner but it popped up on a search of “programming robotc”. This example, where a sensor is read, an error calculated and an action determined, could be applied to any of the sensors you mention.

So perhaps turn this question around and ask "I have problem x, how can I use sensor y to create a solution? ".

The problem could be driving a certain distance, lifting an arm, avoiding an obstacle etc.

I’ve found the following tutorial particularly useful for using RobotC for setting up and programming the integrated encoder module for VEX motors.

I can’t really help you too much with the IME’s (I haven’t even seen them on a robot in front of me before), but I do have a beginners guide to ROBOTC (download, link to thread) which I released a while ago and I might possibly be working on a PID guide. :wink:

Also, the ROBOTC sample files are great too. And, of course, you will be able to find more examples of code on the forums.