Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Limit Switch Problem (http://www.chiefdelphi.com/forums/showthread.php?t=63964)

Boydean 13-02-2008 15:05

Limit Switch Problem
 
Just to make note I don't really know if this goes in the Electrical or Programming...so move it please if its in the wrong one.

Ok, right now I'm having some problems to get the limit switch to work. We have it in "digital_io_18". the code is a simple.

Code:

if(digital_io_18 == 1)
{
 printf("Switch = %d",digital_io_18);
}

digital_io_19 = INPUT;

The problem is that its not changing states, but the controller LED "RC Hardware" is turning yellow(aka +5V output low) when its pressed

PS we have the switch on "normally closed"

PSS we are using kevin's 3.0 code :)

jln646v 13-02-2008 15:13

Re: Limit Switch Problem
 
Why are you using digital_oi_18? Why dont you just use rc_dig_in18? I am not sure if this is the same thing but it might be your problem.

if (rc_dig_in18==1)
{
printf("");
}

Also, when you say your rc hardware light is yellow, your not shorting out the digital input are you? Make sure you are connecting the ground and signal pins, not the ground and +5.

Boydean 13-02-2008 15:25

Re: Limit Switch Problem
 
Danke, that did it. We did in fact have the +5v plugged into it. That was a bad thing.

ay2b 13-02-2008 16:32

Re: Limit Switch Problem
 
Quote:

Originally Posted by jln646v (Post 698136)
Why are you using digital_oi_18? Why dont you just use rc_dig_in18? I am not sure if this is the same thing but it might be your problem.

All the digital pins are INPUT/OUTPUT pins. digital_io_18 is used to set whether the pin is used for input or for output. If it is used for input, then rc_dig_in18 is used to read the value.


All times are GMT -5. The time now is 00:55.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi