I think there is a “gravity” sensor inside joystick which can detact the angle of it.
Anyone knows how to use this function in ROBOTC?
I cannot find anything about this in the HELP.
vexRT[AccelX];
vexRT[AccelY];
turns out using these two commands could do some interesting stuff
Interesting, I will definitely be trying those… As @dereksc said, the commands are:
vexRT[AccelX];
vexRT[AccelY];
Robot C has a sample program in help on using the accelerometer, which is the sensor you’re talking about. It allows you to chain certain motors on you’re robot to an axis on the joystick, so that you could do something like if the x axis on the joystick is greater than 10, then motor 1 = 100 power. The code you have does look like it should work. If it does tan it will give you a wider range of motion than what I just said.
The ‘Gravity’ sensor is a gyroscope, which is weird because they call it an accelerometer…
Accerometers measure Acceleration, Gyroscopes measure tilt.
//Here's a simple code I made :)
motor[motor1]=vexRT[AccelY]+vexRT[AccelX];
motor[motor2]=vexRT[AccelY]-vexRT[AccelX];
I’m pretty sure it’s an accelerometer as it senses the force of gravity, or the would-be acceleration.
Anyone know how to do that for EasyC?
I dont have Easy C in my PC but I’m pretty sure there is a block under the joystick tab called Get Joystick Accelerometer
Thanks, I’ll take a look at that next time I have access to EasyC.