|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Micro Switch Code
Declared 2 Micro Switches
Code:
DigitalInput *flipperdoorright; DigitalInput *flipperdoorleft; Code:
flipperdoorleft = new DigitalInput(1); flipperdoorright = new DigitalInput(2); Code:
if (m_leftStick->GetRawButton(5) == 1 && flipperdoorright == 1 ) {
flipperdoor->Set(Relay::kForward);
//delay(10);
} else if (m_leftStick->GetRawButton(4) == 1 && flipperdoorleft == 1 ){
flipperdoor->Set(Relay::kReverse);
//delay(10);
}
else{
flipperdoor->Set(Relay::kOff);
}
(The Error shows up on the if and else if lines) Error: ISO C++ forbids comparison between pointer and integer I only included the lines giving me the errors and those that are relative to the question. So what am I doing wrong? |
|
#2
|
|||||
|
|||||
|
Re: Micro Switch Code
The flipperdoorright variable is not the value of the switch. It's a pointer to the object which has methods for reading the switch.
Try flipperdoorright->Get() and flipperdoorleft->Get() instead. Congratulations on a very good presentation of your problem, by the way. |
|
#3
|
|||
|
|||
|
Re: Micro Switch Code
Thanks, I am actually just learning a lot of the C++ code this year but I think I am catching on pretty quick.
That solved my problem ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pressure Switch code | kE7JLM | Programming | 3 | 25-01-2008 14:54 |
| Need Help Wiring Micro Switch/Limiting Switch | Windward | Electrical | 2 | 07-02-2006 18:26 |
| Pressure switch code | kingpin3787 | General Forum | 11 | 22-02-2004 21:52 |
| HELP US PLEASE?!?!(pressure switch code) | kingpin3787 | General Forum | 1 | 21-02-2004 15:13 |
| sample limit switch code??? | tml240 | Programming | 5 | 17-02-2004 17:13 |