Go to Post Start respecting your mentors more or they might just leave. - Eric Bareiss [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
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 22-01-2009, 16:53
nate15810's Avatar
nate15810 nate15810 is offline
World's Most Clueless Programmer
FTC #0154 (154 Renegade)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Rhode Island
Posts: 22
nate15810 is an unknown quantity at this point
[FTC]: Top Hat coding problem

ok yet another coding problem for me.

this is my problem:

Code:
if (joystick.joy2_TopHat = 0)
    {
      servo[ServoB] = 20;
    }
    else
    {
      servo[ServoB] = 255;
    }
this won't work, nor will
Code:
if (joy2_TopHat = 0)
i need the top hat button to activate servos, but nothing is working
contacted patrick, but it still doesn't work...he's studying and i don't want to bother him anymore haha
Reply With Quote
  #2   Spotlight this post!  
Unread 22-01-2009, 17:23
ttldomination's Avatar
ttldomination ttldomination is offline
Sunny
no team
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2007
Location: Roanoke, TX
Posts: 2,066
ttldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond repute
Re: [FTC]: Top Hat coding problem

Your problem is just an syntax error.

The sign "=" is an assignment operator where the sign "==" is the comparison operator. So you would have to do...

if(joystick.joy2_TopHat == 0)
{
code goes here
}
__________________
1261: 2007-2012
1648: 2013-2014
5283: 2015
Reply With Quote
  #3   Spotlight this post!  
Unread 22-01-2009, 18:03
nate15810's Avatar
nate15810 nate15810 is offline
World's Most Clueless Programmer
FTC #0154 (154 Renegade)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Rhode Island
Posts: 22
nate15810 is an unknown quantity at this point
Re: [FTC]: Top Hat coding problem

thanks it works
Reply With Quote
  #4   Spotlight this post!  
Unread 23-01-2009, 18:20
Rick TYler Rick TYler is offline
A VEX GUy WIth A STicky SHift KEy
VRC #0010 (Exothermic Robotics)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Redmond, Washington
Posts: 2,000
Rick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond repute
Re: [FTC]: Top Hat coding problem

Quote:
Originally Posted by nate15810 View Post
thanks it works
Ask me how long it took me to remember that "or" in C is really "||". Some of us haven't programmed in C in a L-O-N-G time.
__________________
Exothermic Robotics Club, Venturing Crew 2036
VRC 10A, 10B, 10D, 10Q, 10V, 10X, 10Z, and 575
Reply With Quote
  #5   Spotlight this post!  
Unread 23-01-2009, 19:47
ttldomination's Avatar
ttldomination ttldomination is offline
Sunny
no team
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2007
Location: Roanoke, TX
Posts: 2,066
ttldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond repute
Re: [FTC]: Top Hat coding problem

I have never programmed in C before. I picked up the basic syntax from java and I just needed to learn the functions for this year.

The syntax is amazingly similar.
__________________
1261: 2007-2012
1648: 2013-2014
5283: 2015
Reply With Quote
  #6   Spotlight this post!  
Unread 23-01-2009, 22:33
Rick TYler Rick TYler is offline
A VEX GUy WIth A STicky SHift KEy
VRC #0010 (Exothermic Robotics)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Redmond, Washington
Posts: 2,000
Rick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond repute
Re: [FTC]: Top Hat coding problem

Quote:
Originally Posted by ttldomination View Post
The syntax is amazingly similar.
The secret of software development is that structures replicate a lot across languages, but the language programmers randomly change syntax. You will eventually find yourself thinking, "OK, how do I do recursive functions in this <blank blank> language." You know the structures are there somewhere -- you just need to decipher how to make it work in THIS language. Using "&&" instead of "and," for example, is just an arbitrary choice from the dim past. YMMV.
__________________
Exothermic Robotics Club, Venturing Crew 2036
VRC 10A, 10B, 10D, 10Q, 10V, 10X, 10Z, and 575
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
top hat Loki1989 Programming 3 20-11-2007 21:24
pneumatics coding problem (or technical) wildabyss Programming 2 22-02-2005 22:16
pneumatics coding problem (or technical) wildabyss Pneumatics 2 22-02-2005 22:16
coding problem!! HELP! wildabyss Programming 7 21-02-2005 21:48
Pneumatic Coding Problem lasoaaro Pneumatics 11 18-02-2005 12:11


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

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