moved: accelerometer problem

Hi, I am new to VEX and programming in easyC but I am currently playing around with using the built in accelerometer to control the drive motors on the robot. The program I have made works by using an arcade drive block with 4 motors using the X axis on the accel. to move forward and reverse, and the Y axis on the accel. to turn…or so it should.

My program reads the accel. and retrieves it to a local variable for each of the two axises, then uses an if/else staement to switch between the accel drive and tank drive when a button is pushed.

When i use the terminal window after deploying code to the cortex controller i get constant messages saying something along the lines of “Channel X is out of range on the JoyStick”. I cant figure out what exactly im doing wrong if anything. Can someone give some tips?

Thanks in advanced!

Can you give me an example of your program.

Otherwise this is a sample program.

#include "Main.h"

void main ( void )
      while ( 1 )
            int AccelX = GetJoystickAccelerometer( 1 , 1 ) ; //Get Joystick Accel
            int AccelY = GetJoystickAccelerometer( 1 , 2 ) ;

            int left = AccelY - AccelX ;//Do Some Mixing
            int right = AccelY + AccelX ;

            if ( left > 127 ) //Make sure the variable doesn't overflow the motor
                  left = 127 ;
            if ( left < -127 ) //Make sure the variable doesn't overflow the motor
                  left = -127 ;
            if ( right > 127 ) //Make sure the variable doesn't overflow the motor
                  right = 127 ;
            if ( right < -127 ) //Make sure the variable doesn't overflow the motor
                  right = -127 ;

            SetMotor ( 2 , left ) ; //Set Motors
            SetMotor ( 3 , right ) ;

Ok, I have the X axis of the acceleromter control forward/reverse movement pretty well, is there a way to get more speed out of the motors? Now I’m working on trying to figure out how to get the Y axis the turn the bot, but im not making a whole bunch of headway.

The code attached is the mosr current copy, and works by using the X axis of the accelerometer to drive forward/reverse and uses the up buttons on 5 and 6 to turn left/right.
Testing (43.8 KB)
tilt drive code.txt (1.13 KB)

Look at my code it does both Speed and Direction. If the motors are running at full speed then you have to adjust your gearing. You can test the speed using the online window.