Go to Post I've never liked the pressure pads. This just confirms my suspicions: Pressure pads hate robots. It must be some inferiority complex or something. - Andy A. [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-02-2006, 16:30
NASAbound1636 NASAbound1636 is offline
clueless???
AKA: joe
FRC #1636 (Reds Robotics)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: colorado
Posts: 20
NASAbound1636 is an unknown quantity at this point
#define creation

I am trying to complicate my autonomous file by creating a new variable set to run off of and i need to know how to create a #define code in my .h files so it doesn't spit massive error messages at me for using a "not defined" variable, any instructions on how to properly define something would be nice.
__________________
there are 3 kinds of people in the world. those who can count, and those who can't.
Did you know that 4/3 of all people have trouble with fractions?
there are 10 kinds of people in the world, those who understand binary, and those who don't.
If you have 1 of these and you will let me use it then pm it to me
  #2   Spotlight this post!  
Unread 02-02-2006, 16:55
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: #define creation

I'm a little confused by your question, but this is how you correctly define a constant in a header and then use it in a C file

my_header.h
Code:
#define MY_CONSTANT 1
my_file.c
Code:
#include "my_header.h"
int x  = MY_CONSTANT;
There's not really much more to it than that.
  #3   Spotlight this post!  
Unread 02-02-2006, 21:12
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: #define creation

It sounds like you want to "declare a variable", not "define" anything. Using #define is typically for constants and shortcuts to save typing. What you're probably looking for is something like this:
Code:
  int auto_timer;
  char last_contact;
If you give more information about how you want to use the variable, we can provide more detailed directions on how and where to declare it.
  #4   Spotlight this post!  
Unread 02-02-2006, 23:40
Gamer930's Avatar
Gamer930 Gamer930 is offline
Team 930 and 171 Alumni
AKA: Justin
no team
Team Role: Alumni
 
Join Date: Mar 2002
Rookie Year: 2002
Location: New Berlin, WI
Posts: 388
Gamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to behold
Re: #define creation

you can do stuff like
Code:
 #define GLOBE_MOTOR pwm03
Couple Tips:
- Normally all constants have capital letters
- Use names to label pwm's like in the example above. I found that is it much easier for a Dummy programmer to understand that the code is right and that it is something mechanical
__________________
2010 to Present, Scorekeeper/Field Power Volunteer for FRC/FTC/FLL
2005 - 2010, Team 171 College Mentor
2002 - 2005, Team 930 Student
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
TTL port to a serial port on a demo board ImmortalAres Programming 16 09-07-2005 23:44
Gyro Calibration roboticsjenkins Programming 11 21-02-2005 20:39
heres the code. y this not working omega Programming 16 31-03-2004 15:18
What is wrong with this code???? It won't Compile and I don't know why? Please Help CrashZero Programming 23 26-03-2004 09:44
Need help with Variables ? David Bryan Programming 5 23-02-2004 07:42


All times are GMT -5. The time now is 13:48.

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


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