Go to Post It's wrong to scuttle someone else's boat because you don't think it's seaworthy. You probably don't know that what you were seeing will be called a submarine. - ThatHat [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 10-02-2009, 15:16
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 + Auton?

Hey,

I was trying to get different autons based on switches, and the code is as follows (example):

Quote:
void Autonomous(void)
{
if (s1->Get())
{
myRobot->Drive(-0.6, 0.5);
Wait(1.0);
myRobot->Drive(0.0,0.0);
}
else
{
myRobot->Drive(0.0,0.0);
}
}
and i defined the s1:

Quote:
DigitalInput *s1;
s1 = new DigitalInput(1);
However, when when i ran the auton, it went according to the code inside the if statement even when the switch was off. I was hoping that when the switch was off, it would refer to the "else" part of the code, but the code did not change despite the switch being off or on. What did i do wrong??

THANK YOU!!!
__________________
Team 375: The Robotic Plague
Current Robot: I-Chihuahua
Last Event: Big Apple Breakaway
 


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
Digital Inputs? Straberrie Programming 4 15-02-2009 01:47
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
Auton digital input ten3brousone Programming 7 20-03-2005 22:23
Analog vs Digital inputs? f22flyboy Programming 8 08-11-2002 22:18


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

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