Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   auton variables (http://www.chiefdelphi.com/forums/showthread.php?t=36577)

sirbleedsalot 26-03-2005 11:59

auton variables
 
I am trying to create an autonomous program. Currently I just have everything where it says "add your autonomous code here" however I would like to change it. What I want to do is have some variable like say slow which I could put in my autonomous to make the motors drive at half speed. From what I have read I have to define my variables in the user routines fast.c file like this



/*** DEFINE USER VARIABLES AND INITIALIZE THEM HERE ***/
#define slow



however I don't understand how that would know to set pwms 14 and 15 to 190. I am missing a large portion of the puzzle.

Goobergunch 26-03-2005 12:13

Re: auton variables
 
I'd declare my variable like this:
Code:

/*** DEFINE USER VARIABLES AND INITIALIZE THEM HERE ***/
int slow;

and further down:
Code:

void User_Autonomous_Code(void)
{
slow = 190;

and then even further down:
Code:

/* Add your own autonomous code here.*/

pwm14 = slow;
pwm15 = slow;


Joe Ross 26-03-2005 12:18

Re: auton variables
 
I'd suggest starting at the beginning and doing some reading on basic C. There are a bunch of whitepapers: http://www.chiefdelphi.com/forums/pa... SC&sort=date

These look like good candidates:
http://www.chiefdelphi.com/forums/pa...le&paperid=396
http://www.chiefdelphi.com/forums/pa...le&paperid=380
http://www.chiefdelphi.com/forums/pa...le&paperid=253

sirbleedsalot 26-03-2005 14:11

Re: auton variables
 
Thanks for your help, I had already read some of those white papers, however I was confused by them. Also how do you add the code quote to your posts?

Goobergunch 26-03-2005 14:24

Re: auton variables
 
[ code]printf("Hello, world!");[/code] (without the first space) yields
Code:

printf("Hello, world!");


All times are GMT -5. The time now is 03:57.

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