Go to Post our family has no borders... - Greg Hainsworth [more]
Home
Go Back   Chief Delphi > Other > VEX
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-03-2007, 15:45
tinderfitles tinderfitles is offline
I dont do work on my team!
AKA: Craig o-(-_-Q)
FTC #1180 (Atomsmashers)
Team Role: Leadership
 
Join Date: Feb 2004
Rookie Year: 2003
Location: Savannah, GA
Posts: 9
tinderfitles is an unknown quantity at this point
Question File Inclusion

Heres what I'm after:

Our team has created a backup limit switch system for our robot, and to challenge myself, I'm making it so that the limit switches add together and depending on the number reached, the arm of our robot will either be allowed to move up or it will remain in its current position until a down signal is recieved from the controller. now, I'm having an issue with negative numbers, and I'm attempting to get easyC to include the ANSI header file "stdlib.h" to allow me to use the absolute value function, however, easyC has a seizure when I attempt to include the file..... any suggestions? I've tried placing the file in the same folder as "UserAPI.h" [or whatever it's called], but to no result.
__________________
"Theres three main teams at our school, Robotics, Football, and Basketball. The other two havent won a state competition since the Cuban Missle Crisis." - Stubbs

"I make robots yo" -Stubbs
Reply With Quote
  #2   Spotlight this post!  
Unread 13-03-2007, 17:00
FourPenguins's Avatar
FourPenguins FourPenguins is offline
Back in the Game
AKA: Ed Venator
FRC #2399
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2005
Location: Mount Olive, NJ
Posts: 261
FourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud of
Re: File Inclusion

One solution would be to just write your own absolute value function.

Code:
int abs(int x){
    if(x<0)
        return x*-1;
    return x;
}
__________________
MORT 11
-2005 New Jersey Regional Chairman's Award Winner
-2006 Palmetto Regional Winner
-2007 New York Regional Delphi Driving Tomorrow's Technology Award
-2008 New Jersey Regional Finalist, Chesapeake Regional Winner, Championship Event Overall Top Seed
HB 2399
-2009 Buckeye Regional Delphi Driving Tomorrow's Technology Award, Pittsburgh Regional GM Industrial Design Award
Reply With Quote
  #3   Spotlight this post!  
Unread 14-03-2007, 12:36
tinderfitles tinderfitles is offline
I dont do work on my team!
AKA: Craig o-(-_-Q)
FTC #1180 (Atomsmashers)
Team Role: Leadership
 
Join Date: Feb 2004
Rookie Year: 2003
Location: Savannah, GA
Posts: 9
tinderfitles is an unknown quantity at this point
Re: File Inclusion

but do keep in mind that I'm using easyC, so writing my own function would be a headache. I just want to include "stdlib.h" to shorten the time until completion. an issue I noticed is that the file isn't being properly included because easyC won't put the next #include function in quotes

it looks something similar to this:
Code:
#include "UserAPI.h"

#include stdlib.h
if anyone knows how to include the quotes, please let me know. and yes, I have tried just typing the filename to include in quotes..... [if only it were that simple...]
__________________
"Theres three main teams at our school, Robotics, Football, and Basketball. The other two havent won a state competition since the Cuban Missle Crisis." - Stubbs

"I make robots yo" -Stubbs
Reply With Quote
  #4   Spotlight this post!  
Unread 15-03-2007, 21:14
sovierr's Avatar
sovierr sovierr is offline
Teacher Advisor
AKA: Rich Soviero
FRC #0180 (& FTC 283/284 - SPAM)
Team Role: Teacher
 
Join Date: Nov 2006
Rookie Year: 2006
Location: Jensen Beach, FL
Posts: 63
sovierr is on a distinguished road
Re: File Inclusion

Maybe you can just count up each time the limit switch is pressed. Then to check the state you can see if the limit switch counter variable is even or odd. You can do this by dividing by 2 and using the remainder (zero=even, 1=odd). I don't know the c commands for remainders, as I do most of my programming in VBScript. Usually there is a mod function that is a truncated division (gives the integer portion of the quotient and drops the remainder). IF you subtract the integer mod quotient from the real# quotient you can check the real # answer. If it is zero you've got an even #. If it is not zero you've got an odd number.

Than again, if you can;t use and absolute value function without including it, you probably won't be able to use a mod function either. Anyway, I hope this helps you to some degree.
Reply With Quote
Reply


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
"Error.MCP" file after HEX file trans iwdu15 Programming 1 24-01-2007 20:05
Help! making an inventor file into an autodesk file kjhobin Inventor 5 19-03-2006 23:04
File inclusion issue: Joshua Lynn Programming 1 10-02-2006 08:34
File resize? ryan_f Website Design/Showcase 9 10-10-2004 12:03
How do we convert a modified user routines file into a valid .HEX file HuskieRobotics Programming 13 28-02-2004 12:12


All times are GMT -5. The time now is 22:12.

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