|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Joystick Button Controlling Relay
Hello,
I'm having problems with the code I have written. Every time I compile the .cpp file it tells me: 'If' undeclared (first use of the function) 'Else' undeclared (first use of the function) I think this means that the if and else statement do not know what they are controlling. Please correct me if I'm wrong. This is my code below: Code:
{
If(stick->GetRawButton(1));
relay1->Set(Relay::kForward); // run line when button is pressed
Else;
relay1->Set(Relay::kOff); // or run this line when button isn't pressed
}
|
|
#2
|
||||||
|
||||||
|
Re: Joystick Button Controlling Relay
if and else should all be lowercase, they are reserved words.
You also shouldn't have a semicolon after the if or the else http://www.cprogramming.com/tutorial/lesson2_tg.html |
|
#3
|
|||
|
|||
|
Re: Joystick Button Controlling Relay
Perfect, thanks for the advice and resources. Seemed to have solved the issue.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Controlling the camera with a joystick | Dakabt | Programming | 9 | 02-01-2010 09:51 PM |
| Joystick Button Issues | pyr0b0y | NI LabVIEW | 6 | 04-21-2009 09:29 AM |
| joystick button | furiousgeorge | Programming | 5 | 02-07-2009 03:57 PM |
| How do I program a relay to turn on and off by pressing a button on the joystick? | eweathers | NI LabVIEW | 4 | 01-28-2009 10:34 PM |
| Speed controlling a relay..?!?!?one/???? | Monochron | Programming | 13 | 02-17-2007 09:43 PM |