Go to Post The more time we spend there, and the more investment we have in the team, the more rewarding it is. - ILAMtitan [more]
Home
Go Back   Chief Delphi > Other > VEX
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 24-11-2006, 12:00
Ctx32 Ctx32 is offline
Registered User
no team
 
Join Date: Apr 2006
Location: Florida
Posts: 10
Ctx32 is an unknown quantity at this point
R2D2 Programming

I have a problem with some coding.
I need to add Remote functions to my coding to override my Ultras and being a NEWBIE, I can't get it right. I'm using Vex 2.0 and heres what I have so far:

#include "Main.h"

void main ( void )
{
int Loop = 1;
int UltraLeft;
int BumperLeft;
int BumperFront;
int UltraRight;
int BumperRight;
int UltraFront;

// Ultras will be mounted in the Legs (1 Left/1 Right)
// Remote must Override Ultras/Bumper Switches
// Inside Dome are 3- Bumpers (Front-Left-Right)
while ( Loop == 1 ) // When Power is Turned on, This will set Dome to Home Position
{
BumperFront = GetDigitalInput ( 11 ) ;
SetMotor ( 1 , 255 ) ;
if ( BumperFront == 0 )
{
SetMotor ( 1 , 127 ) ;
break ; // At this Point, It will leave this area of Code until Total Vex Restart
}
}
Wait ( 4000 ) ; // Sits in Home Position before Activating Ultras
while ( Loop == 1 )
{
BumperFront = GetDigitalInput ( 11 ) ; // Home Position Bumper Switch (Dome facing Foward)
if ( BumperFront == 0 )
{
SetMotor ( 1 , 127 ) ; // Had to add a Stop here for the return of the dome to stop
StartUltrasonic ( 1 , 6 ) ; // Left Ultra for dome Rotation (Left)
UltraLeft = GetUltrasonic ( 1 , 6 ) ; // Detects if someone is near Leftside
StartUltrasonic ( 2 , 7 ) ; // Right Ultra for Dome movement
UltraRight = GetUltrasonic ( 2 , 7 ) ; // Detects if Someone is near the Rightside
if ( UltraLeft < 35 )
{
SetMotor ( 1 , 255 ) ; // Turns Dome to the Left
}
if ( UltraRight < 35 )
{
SetMotor ( 1 , 0 ) ;
}
}
BumperLeft = GetDigitalInput ( 10 ) ; // Left Bumper Stop Switch
if ( BumperLeft == 0 )
{
SetMotor ( 1 , 127 ) ;
Wait ( 3000 ) ; // Dome will pause then Return to Home Position
SetMotor ( 1 , 0 ) ;
}
BumperRight = GetDigitalInput ( 12 ) ;
if ( BumperRight == 0 )
{
SetMotor ( 1 , 127 ) ;
Wait ( 3000 ) ; // Same as above
SetMotor ( 1 , 255 ) ;
}
// Perfect up to here, But the Ultras are not pausing
}
}
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
programming motors with programming kit BorisTheBlade FIRST Tech Challenge 4 01-11-2005 19:03
Programming newgrl101 Programming 3 05-02-2005 13:05
Programming randomperson FIRST-related Organizations 24 08-06-2003 19:13
Programming Gusman1188 Programming 5 17-02-2003 11:23
Programming archiver 2001 10 23-06-2002 23:01


All times are GMT -5. The time now is 22:18.

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