|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
[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;
}
Code:
if (joy2_TopHat = 0) contacted patrick, but it still doesn't work...he's studying and i don't want to bother him anymore haha |
|
#2
|
||||
|
||||
|
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 } |
|
#3
|
||||
|
||||
|
Re: [FTC]: Top Hat coding problem
thanks it works
|
|
#4
|
|||
|
|||
|
Re: [FTC]: Top Hat coding problem
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.
![]() |
|
#5
|
||||
|
||||
|
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. |
|
#6
|
|||
|
|||
|
Re: [FTC]: Top Hat coding problem
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |