ARDUINO Functions Remote Control - IFI

From ROBOTC API Guide
Jump to: navigation, search
Functions and Variables → Remote Control - IFI


Transmittervoltage.jpg


Color Key
Function:
Variable:


bVEXNETActive

const bool bVEXNETActive
(bool) Boolean flag indicating whether VEXNET WiFi or legacy 75 MHZ RF wireless transmission is used.
if(bVEXNETActive = true) 
{
  // Vexnet is active 
}


nIfiSPIMsgCounts

const word nIfiSPIMsgCounts
(word) Variable counts the number of SPI messages received by the user CPU from the master CPU.
while(nIfiSPIMsgCounts < 500) 
{
  // Less than 500 SPI messages have been sent. 
}


nVexRCReceiveState

const TVexReceiverState nVexRCReceiveState
(TVexReceiverState) Integer value representing the current state of the transmitters connected to the VEX. This variable will return a different value depending upon the current configuration of remote transmitters connected to the VEX controller.
bIfiAutonomousMode = false;
int statusbit = 0;
 
  while(true)
  {
    statusbit = nVexRCReceiveState;
    wait1Msec(25);
    // No Crystals = 0
    // One Transmitter = 1
    // Two Transmitter = 2
    // One and Two Transmitter = 3
    // One VEXnet = 8
    // Two VEXnet = 10  
  }


vexRT

const word vexRT[TVexJoysticks joystickOrButton]
(word) Array that contains the values of the joysticks and buttons from an VEX RF Transmitter. Supports channels Ch1 through Ch6. Returns values between -127 and 127 (normalized for motor values in ROBOTC.)
Parameter Explanation Data Type
joystickOrButton A joystick channel or button channel. TVexJoysticks
while(true)
{
  motor[port2] = vexRT[Ch2]; //Motor port 2 speed is determined by Ch2 on the Remote Transmitter
  motor[port3] = vexRT[Ch3]; //Motor port 3 speed is determined by Ch3 on the Remote Transmitter
}


Controller 1

Ch1

TVexJoysticks Ch1
(TVexJoysticks) X-Axis - Right Joystick
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch1];  // set the motor, 'armMotor' to the right joystick's X-axis
}


Ch2

TVexJoysticks Ch2
(TVexJoysticks) Y-Axis - Right Joystick
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch2];  // set the motor, 'armMotor' to the right joystick's Y-axis
}


Ch3

TVexJoysticks Ch3
(TVexJoysticks) Y-Axis - Left Joystick
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch3];  // set the motor, 'armMotor' to the left joystick's Y-axis
}


Ch4

TVexJoysticks Ch4
(TVexJoysticks) X-Axis - Left Joystick
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch4];  // set the motor, 'armMotor' to the left joystick's X-axis
}


Ch5

TVexJoysticks Ch5
(TVexJoysticks) Left-hand, rear buttons
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch5];  // set the motor, 'armMotor' to the left-hand rear buttons.
}


Ch6

TVexJoysticks Ch6
(TVexJoysticks) Right-hand, rear buttons
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch6];  // set the motor, 'armMotor' to the right-hand rear buttons.
}


Controller 2

Ch1Xmtr2

TVexJoysticks Ch1Xmtr2
(TVexJoysticks) X-Axis - Right Joystick
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch1Xmtr2];  // set the motor, 'armMotor' to the right joystick's X-axis
}


Ch2Xmtr2

TVexJoysticks Ch2Xmtr2
(TVexJoysticks) Y-Axis - Right Joystick
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch2Xmtr2];  // set the motor, 'armMotor' to the right joystick's Y-axis
}


Ch3Xmtr2

TVexJoysticks Ch3Xmtr2
(TVexJoysticks) Y-Axis - Left Joystick
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch3Xmtr2];  // set the motor, 'armMotor' to the left joystick's Y-axis
}


Ch4Xmtr2

TVexJoysticks Ch4Xmtr2
(TVexJoysticks) X-Axis - Left Joystick
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch4Xmtr2];  // set the motor, 'armMotor' to the left joystick's X-axis
}


Ch5Xmtr2

TVexJoysticks Ch5Xmtr2
(TVexJoysticks) Left-hand, rear buttons
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch5Xmtr2];  // set the motor, 'armMotor' to the left-hand rear buttons
}


Ch6Xmtr2

TVexJoysticks Ch6Xmtr2
(TVexJoysticks) Right-hand, rear buttons
while(true)                        // infinite loop:
{
  motor[armMotor] = vexRT[Ch6Xmtr2];  // set the motor, 'armMotor' to the right-hand rear buttons
}