Go to Post I think FIRST is probably close to the farthest you can get from 'gangsta', outscored only by the math team. - Tom Bottiglieri [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 12-02-2009, 21:25
dboisvert dboisvert is offline
Registered User
AKA: Dan Boisvert
FRC #2405 (Divided by Zero)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Michigan
Posts: 57
dboisvert is an unknown quantity at this point
Micro Switch Code

Declared 2 Micro Switches

Code:
DigitalInput *flipperdoorright;
DigitalInput *flipperdoorleft;
Where I want the variables to get data from

Code:
flipperdoorleft = new DigitalInput(1);
flipperdoorright = new DigitalInput(2);
What I want it do with those variables

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?
Reply With Quote
  #2   Spotlight this post!  
Unread 13-02-2009, 00:15
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: 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.
Reply With Quote
  #3   Spotlight this post!  
Unread 13-02-2009, 13:34
dboisvert dboisvert is offline
Registered User
AKA: Dan Boisvert
FRC #2405 (Divided by Zero)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Michigan
Posts: 57
dboisvert is an unknown quantity at this point
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
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
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


All times are GMT -5. The time now is 14:51.

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