View Full Version : auton variables
sirbleedsalot
26-03-2005, 11:59
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
I'd declare my variable like this:
/*** DEFINE USER VARIABLES AND INITIALIZE THEM HERE ***/
int slow;
and further down:
void User_Autonomous_Code(void)
{
slow = 190;
and then even further down:
/* Add your own autonomous code here.*/
pwm14 = slow;
pwm15 = slow;
Joe Ross
26-03-2005, 12:18
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/papers.php?s=&categoryid=6&perpage=10&direction=DESC&sort=date
These look like good candidates:
http://www.chiefdelphi.com/forums/papers.php?s=&action=single&paperid=396
http://www.chiefdelphi.com/forums/papers.php?s=&action=single&paperid=380
http://www.chiefdelphi.com/forums/papers.php?s=&action=single&paperid=253
sirbleedsalot
26-03-2005, 14:11
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
[ code]printf("Hello, world!");[/code] (without the first space) yields printf("Hello, world!");
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.