Segway Vex

I Started to build a “segway” robot from vex, using an accelerometer, but all i have is a copy of easyc for vex 2.0, i know that easy c pro 2.0 had a built in code for the accelerometer, but is there a way to input a custom code for the accelerometer in easyc, and if so, could someone please tell me the code?

I have EasyC V2 also and all you need to read the accelerometer is the Analog Input block.

You just need a variable and one block for each output from the accelerometer that you want to read. Then write your program to respond to the readings you get.

EasyC PRO does have a block especially for an accelerometer, but you don’t really need it. The block just allows you to select which chip your accelerometer is using and probably makes some adjustments for that. It was really made for third party accelerometers that were used in FIRST competetions.

(Someone please correct me if I am wrong)


The accelerometer commands available from the 2008 FRC season’s code are listed below.

InitAccelerometer(unsigned char port);
StartAccelerometer(unsigned char port);
StopAccelerometer(unsigned char port);
GetAcceleration(unsigned char port);
GetVelocity(unsigned char port);
GetDistance(unsigned char port);
StopAccelerometer(unsigned char port);

The PIC CPU they used was almost identical to the VEX. If you would like access to these commands, you’ll need to get the MPLAB setup described in this thread:

All these functions work just fine on the VEX. Their accuracy is debatable, but the commands do work.

Hope this helps. Let us know how you’re doing with your project, or if you need any help.