Go to Post As a team leader if I do not INSPIRE I have failed, and I do not like to fail. - Mike Martus [more]
Go Back   Chief Delphi > Competition > OCCRA > OCCRA Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-29-2016, 11:27 AM
jimk3038 jimk3038 is offline
Registered User
FRC #4384
Join Date: Sep 2013
Location: Troy
Posts: 6
jimk3038 is an unknown quantity at this point
[OCCRA]: OCCRA Software Template for RobotC

Did I hear there is a software template for RobotC and OCCRA? Can I assume this is a C skeleton for basic robot control? Or, do I have this completely wrong? If yes, where I can I find this source code skeleton / template.

Jim Kemp
Benzene Bots
Reply With Quote
  #2   Spotlight this post!  
Unread 09-29-2016, 04:31 PM
pjt0620 pjt0620 is offline
Registered User
no team
Join Date: Sep 2016
Location: Livonia MI,
Posts: 4
pjt0620 is an unknown quantity at this point
Re: [OCCRA]: OCCRA Software Template for RobotC

Here is a simple example of a tank drive with the left motor being on pwm 1 and the right motor being on pwm 2
Basic OCCRA Tank drive example
Disclaimer: Not tested due to lack of cortex
#pragma platform(VEX2) //This is to tell the compiler that you are using the cortex
#pragma competitionControl(Competition) //This tells the compiler that your robot will have to listen to the field for when it can go
#include "Vex_Competition_Includes.c" //This is telling it how the field will talk to it

//Here we assign variables to more friendly names 
int leftMotor = port1;
int rightMotor = port2;
//Refrence guide for controler at http://www.robotc.net/wikiarchive/VEX2_Functions_Remote_Control_-_VEXnet
int leftJoystick = Ch3;
int rightJoystick = Ch2;
//End of declarations

void pre_auton(){}//This is a function used to set up tasks before the match
task autonomous(){}//This is a function used for an autonomous mode, OCCRA does not have autonomous modes so ignore this function
task usercontrol()//When the match begins the field tells the cortex to run the code in this function
	while (true) //This function tells your robot to keep running the code inside this loop
		motor[leftMotor] = vexRT[leftJoystick]; //Here we set the speed of the left motor, -127 being full reverse 0 being neutral and 127 being full forward to the left joysticks output
		motor[rightMotor] = vexRT[rightJoystick]; //Here we set the speed of the right motor, -127 being full reverse 0 being neutral and 127 being full forward to the right joysticks output
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 09:40 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi