Go to Post Everyone knows the best way to lose weight is to turn the robot upside down, shake vigourously, and throw away anything that falls out. - Mark Hamilton [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 04-02-2007, 06:11
HellBoy HellBoy is offline
Registered User
FTC #2230
 
Join Date: Jan 2007
Location: Israel
Posts: 7
HellBoy is an unknown quantity at this point
why does aux1 doesn't work?

Here is the code and from some reason doesn't work.
Code:
if(p1_sw_aux1==1)
{
g=1;
}
if(g==1)
{
z++;
}
if((z<=30)&&(a==1))
{
relay1_fwd=1;
}
else
a=0;
  #2   Spotlight this post!  
Unread 04-02-2007, 10:11
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,588
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: why does aux1 doesn't work?

First of all, it would help if you explained what you wanted the code to do. Secondly, it would help to describe what you've proven works or doesn't work. For example, have you used this code with another switch and it worked correctly? Have verified that p1_sw_aux1 doesn't switch, or do you not really know?

If I had to guess at what the problem is with no other information, I'd say that z (and maybe some of the other variables, depending on the rest of your code) are not declared static.
  #3   Spotlight this post!  
Unread 04-02-2007, 10:51
HellBoy HellBoy is offline
Registered User
FTC #2230
 
Join Date: Jan 2007
Location: Israel
Posts: 7
HellBoy is an unknown quantity at this point
Re: why does aux1 doesn't work?

I tried to turn the Globe engine for 0.8 seconds when I press aux1.
Appearently, it doesn't work even the variables are declered as static.
Is the code correct?
  #4   Spotlight this post!  
Unread 04-02-2007, 11:22
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
Re: why does aux1 doesn't work?

is "a" initialized as 1?

As a side note,
Code:
if(g==1)
{
z++;
}
can be written as
Code:
if(g)
z++;
just to save time (but some people don't like it). same with everything else that will only be 1 or 0. the brackets are only needed if there is more than 1 line of code.
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."
  #5   Spotlight this post!  
Unread 04-02-2007, 11:31
Bomberofdoom's Avatar
Bomberofdoom Bomberofdoom is offline
Biggest FIRST addict in Israel
AKA: Nir Levanon
FRC #2230 (Zcharia's Angels)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Israel
Posts: 471
Bomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond repute
Send a message via MSN to Bomberofdoom
Re: why does aux1 doesn't work?

I'm working with him on the code and a is intializied as 1. Should all the int varibles be static?
  #6   Spotlight this post!  
Unread 04-02-2007, 12:11
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: why does aux1 doesn't work?

Quote:
Originally Posted by HellBoy View Post
I tried to turn the Globe engine for 0.8 seconds when I press aux1.
Appearently, it doesn't work even the variables are declered as static.
Is the code correct?
At the very least, it is incomplete.

What does happen when you press aux1? Does the Globe motor start running and never stop? There is nothing in your code to turn it off after the time has elapsed.
  #7   Spotlight this post!  
Unread 04-02-2007, 15:33
Xenosthebest Xenosthebest is offline
Registered User
FRC #0701
 
Join Date: Feb 2007
Location: Travis AFB
Posts: 14
Xenosthebest is an unknown quantity at this point
Re: why does aux1 doesn't work?

do you have aux1 defined in your header file? check to see if it is going to the right place and not into a different file. Recheck your variables and make sure your definitions are what you want them to be.
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
Why doesn't this work??!??!!?!!!?!? HuskieRobotics Programming 13 05-03-2004 00:20
Arrrrrrrg... PM alert doesn't work DanL CD Forum Support 9 08-05-2003 14:32
Edit doesn't work on original title posts??? Elgin Clock CD Forum Support 6 12-03-2003 17:30
Robot reset on OI doesn't work Carl Owenby General Forum 1 07-02-2003 07:23
sensor doesn't work PBoss Programming 7 29-01-2003 18:39


All times are GMT -5. The time now is 23:56.

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