Pros Aton program not working

so ive got my driver control program working now and i did some coding for the atonamous program and when i take the competition switch and switch it to aton and enabled it sits there and does nothing i dont know if i have to do an include for the main op control file but i wont be able to do an testing till monday or tuesday but from what i did testing two weeks ago it didnt take any reaction to what i was doing.

op control code:

/** @file opcontrol.c
 * @brief File for operator control code
 *
 * This file should contain the user operatorControl() function and any functions related to it.
 *
 * Copyright (c) 2011-2014, Purdue University ACM SIG BOTS.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Purdue University ACM SIG BOTS nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL PURDUE UNIVERSITY ACM SIG BOTS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Purdue Robotics OS contains FreeRTOS (http://www.freertos.org) whose source code may be
 * obtained from http://sourceforge.net/projects/freertos/files/ or on request.
 */

#include "main.h"

/*
 * Runs the user operator control code. This function will be started in its own task with the
 * default priority and stack size whenever the robot is enabled via the Field Management System
 * or the VEX Competition Switch in the operator control mode. If the robot is disabled or
 * communications is lost, the operator control task will be stopped by the kernel. Re-enabling
 * the robot will restart the task, not resume it from where it left off.
 *
 * If no VEX Competition Switch or Field Management system is plugged in, the VEX Cortex will
 * run the operator control task. Be warned that this will also occur if the VEX Cortex is
 * tethered directly to a computer via the USB A to A cable without any VEX Joystick attached.
 *
 * Code running in this task can take almost any action, as the VEX Joystick is available and
 * the scheduler is operational. However, proper use of delay() or taskDelayUntil() is highly
 * recommended to give other tasks (including system tasks such as updating LCDs) time to run.
 *
 * This task should never exit; it should end with some kind of infinite loop, even if empty.
 */

void operatorControl() {

	// Declare inital values.

		//Intial Movement Values.
		int X2 = 0;
		int Y1 = 0;
		int X1 = 0;
		int threshold = 7; //Declare Deadzone Limit to zero out all motors if not above.

		// Inital Debugging Values.
		int debugCtr = 0;

		// Motor Port Values.
		int frontright = 3;
		int backright =  9;
		int frontleft = 2;
		int backleft = 8;

    while(1){/*Loop Forever*/
    	//Declare Joysticks.
        int leftStickUp = joystickGetAnalog(1, 4);
        int leftStickLeft = joystickGetAnalog(1, 3);
        int rightStickLeft = joystickGetAnalog(1, 1);

        //Create "deadzone" for Y1/Ch3, Left Joystick Up and Down.
        if(abs(leftStickUp) > threshold){
            Y1 = leftStickUp; // If leftStickUp is above +/- 7 then Y1 = Joystick leftStickUp (position)
        }else{
            Y1 = 0;//If Joystick leftStickUp is below +/- 7 then Y1 = 0
        }
        //Create "deadzone" for X1/Ch4, Left Joystik Left and Right.
        if(abs(leftStickLeft) > threshold){
            X1 = leftStickLeft; //If Joystick leftstickLeft is above +/- 7 then X1 = Joystick leftStickLeft (position)
        }else{
            X1 = 0;//If Joystick leftStickLeft is below +/- 7 then X1 = 0
        }
        //Create "deadzone" for X2/Ch1, Right Joystick Left and Right.
        if(abs(rightStickLeft) > threshold){
            X2 = rightStickLeft;//If Joystick rightStickLeft is above +/- 7 then X2 = Joystick rightStickLeft (position)
        }else{
            X2 = 0;//If Joystick rightStickLeft is below +/- 7 then X2 = 0
        }
        //Math Logic for each Motor.
        motorSet(frontright, -Y1 + X2 + X1);
        motorSet(backright, Y1 + X2 + X1);
        motorSet(frontleft, -Y1 + X2 - X1);
        motorSet(backleft, Y1 + X2 - X1);

        delay(20);//Required for any working program at the end of the program. in milliseconds?

        //Debugging Command.

/*        if( debugCtr++ == 5 ) //Display Y1, X1, X2 Values in PROS Terminal for debugging.
            {
            debugCtr = 0;
            printf("drive vals %d %d %d\r\n", Y1, X1, X2 );
            }*/

        }
}

auto code:

/** @file auto.c
 * @brief File for autonomous code
 *
 * This file should contain the user autonomous() function and any functions related to it.
 *
 * Copyright (c) 2011-2014, Purdue University ACM SIG BOTS.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Purdue University ACM SIG BOTS nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL PURDUE UNIVERSITY ACM SIG BOTS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Purdue Robotics OS contains FreeRTOS (http://www.freertos.org) whose source code may be
 * obtained from http://sourceforge.net/projects/freertos/files/ or on request.
 */

#include "main.h"

/*
 * Runs the user autonomous code. This function will be started in its own task with the default
 * priority and stack size whenever the robot is enabled via the Field Management System or the
 * VEX Competition Switch in the autonomous mode. If the robot is disabled or communications is
 * lost, the autonomous task will be stopped by the kernel. Re-enabling the robot will restart
 * the task, not re-start it from where it left off.
 *
 * Code running in the autonomous task cannot access information from the VEX Joystick. However,
 * the autonomous function can be invoked from another task if a VEX Competition Switch is not
 * available, and it can access joystick information if called in this way.
 *
 * The autonomous task may exit, unlike operatorControl() which should never exit. If it does
 * so, the robot will await a switch to another mode or disable/enable cycle.
 */

void autonomous() {
		// Motor Port Values.
		int frontright = 3;
		int backright =  9;
		int frontleft = 2;
		int backleft = 8;

	void move(int Y1, int X1, int X2,int timeDelay){

	//Math Logic for each Motor.
        motorSet(frontright, -Y1 + X2 + X1);
        motorSet(backright, Y1 + X2 + X1);
        motorSet(frontleft, -Y1 + X2 - X1);
        motorSet(backleft, Y1 + X2 - X1);
        delay(timeDelay);//Required for any working program at the end of the program. in milliseconds?
	}

	move(0, 127, 0, 1 );
	move(0, 0, 127, 0.25);
	move(0, 127, 0, 3);
	move(-50, -127, 0, 0.5);
	move(0, -127, 0, 2);
	move(0, 0, 0, 0);




}

any help is appreciated.

Don’t put functions inside other functions.

okay i don’t think that will be the problem i think when i tested it, that didn’t seem to make any difference but ill take another shot at it when i get back into class hopefully Monday or Tuesday.

gcc supports nested functions but the C standard does not, so it’s not very portable code. No it’s not your problem, the problem is that you pass a delay as a float (presumably seconds) where the delay function wants a delay in mS.

/**
 * Wiring-compatible alias of taskDelay().
 *
 * @param time the duration of the delay in milliseconds (1 000 milliseconds per second)
 */
void delay(const unsigned long time);

Quick question (from someone that barely gets by with code). Is your above statement a ‘best practice’ sort of thing. Or are functions within functions a big no no.

Edit: You maybe just answered my question with your post right before this one?

ok so i just need to add a longer delay at the end of the aton code and ive been working on developing our method for chosing which pogram we are gonna use for aton depending on what square we start in but we are gonna start playing with that here in the next few weeks ive got the code down and will try it when i get back