Go to Post John Abele certainly deserves much more recognition than he gets. - Richard Wallace [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 02-20-2010, 09:04 PM
TUBZ TUBZ is offline
Registered User
FRC #1622
 
Join Date: Jan 2009
Location: California
Posts: 7
TUBZ is an unknown quantity at this point
Exclamation Limit switch not working properly.

We want to use two limit switches to control a motor in forward and in reverse.

The limit switches are actuating on all channels of the digital sidecar, it does not matter which port we plug it into. We want the switch to stop the individual motors from running. We have tried both constructors (channel only, as well as slot and channel) with the same results. Our code is:

Code:
DigitalInput *limitSwitchReverse;
DigitalInput *limitSwitchForward;

// Ctr using only channel
limitSwitchReverse = new DigitalInput(13);
limitSwitchForward = new DigitalInput(14);

// Alternative: Ctr using slot and channel
//limitSwitchReverse = new DigitalInput(4, 13);
//limitSwitchForward = new DigitalInput(4, 14);


if (btn1)
{
	if(limitSwitchReverse->Get() == 0)
	{
		device->Set(Relay::kOff);
	}
	else
	{
		device->Set(Relay::kReverse);					
	}
}
else if (btn2)
{
	if(limitSwitchForward->Get() == 0)
	{
		device->Set(Relay::kOff);
	}
	else
	{
		device->Set(Relay::kForward);					
	}
}
else 
{
	device->Set(Relay::kOff);
}
could someone please post a sample code which demonstrates the correct way to use a limit switch connected to the Digital I/O, to interrupt a spike connected to the Relay.


Thanks
__________________
.~~~
SHIZAMLES!!!
Reply With Quote
 


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
Code not loading properly Al3+ C/C++ 19 01-31-2010 01:11 AM
Laptop is not finding the cRIO properly? Studentish Electrical 4 05-07-2009 12:03 PM
1 joystick controls not turning properly andrew_4_life Programming 4 03-28-2008 01:22 AM
Using a limit switch to limit motion ManicMechanic Programming 16 12-20-2007 12:54 AM
PLEASE HELP: OI switch box not working RbtGal1351 Control System 2 02-18-2006 07:34 PM


All times are GMT -5. The time now is 10:42 AM.

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