Go to Post If winning that individual match is more important to you than being there in the first place, then I believe you've got your priorities in the wrong spot. - Tom Bottiglieri [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-02-2009, 19:57
Straberrie's Avatar
Straberrie Straberrie is offline
The Plague
AKA: Rebecca
FRC #0375 (Robotic Plague)
Team Role: Programmer
 
Join Date: Feb 2008
Rookie Year: 2007
Location: New York
Posts: 59
Straberrie will become famous soon enough
Digital Inputs?

Hello!

I am using C++ and I have a question about implementing Digital Inputs in the code... Is Get() the function that means "true" or no? I basically want an if statement saying if DigitalInput1 is true, then this, but I am unsure which function to use to set the condition... =(

Thank you!!!
__________________
Team 375: The Robotic Plague
Current Robot: I-Chihuahua
Last Event: Big Apple Breakaway
  #2   Spotlight this post!  
Unread 08-02-2009, 20:32
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Digital Inputs?

DigitalInput DigtalInput1(1);//port1
if (DigialInput.Get())
{
do this
}
else
{
do that
}
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
  #3   Spotlight this post!  
Unread 09-02-2009, 20:07
Straberrie's Avatar
Straberrie Straberrie is offline
The Plague
AKA: Rebecca
FRC #0375 (Robotic Plague)
Team Role: Programmer
 
Join Date: Feb 2008
Rookie Year: 2007
Location: New York
Posts: 59
Straberrie will become famous soon enough
Re: Digital Inputs?

Thank you!!!!!!
__________________
Team 375: The Robotic Plague
Current Robot: I-Chihuahua
Last Event: Big Apple Breakaway
  #4   Spotlight this post!  
Unread 14-02-2009, 23:27
programMORT11
 
Posts: n/a
Re: Digital Inputs?

how would you do this in C without adding the C++ digitalinput objects? could you cast the UINT32 GetDigitalInput() function results to boolean?
  #5   Spotlight this post!  
Unread 15-02-2009, 01:47
Redneck's Avatar
Redneck Redneck is offline
Hacker Hick
AKA: Jamie (2.0) Moran
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Aug 2004
Rookie Year: 2004
Location: California
Posts: 90
Redneck is just really niceRedneck is just really niceRedneck is just really niceRedneck is just really nice
Send a message via AIM to Redneck
Re: Digital Inputs?

Quote:
Originally Posted by programMORT11 View Post
how would you do this in C without adding the C++ digitalinput objects? could you cast the UINT32 GetDigitalInput() function results to boolean?
I don't believe so, because C doesn't have a bool data type. Traditionally boolean logic is done in C with integers with 0 for false and 1 for true. It'll still work the same way. If you have
Code:
if(GetDigitalInput()){
    // something
}
it'll work the same way as the C++ bool value.
__________________


Which badges can you claim?
Closed Thread


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
Using Interrupts on Digital Inputs Analog C/C++ 6 03-02-2009 23:05
Digital Inputs KRibordy C/C++ 5 25-01-2009 00:35
reading multiple digital inputs angelkat Programming 2 25-01-2009 00:22
Digital inputs, bandwith, errors? Micah Brodsky Programming 7 20-01-2003 16:08
Analog vs Digital inputs? f22flyboy Programming 8 08-11-2002 22:18


All times are GMT -5. The time now is 21:54.

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