Go to Post Clearly and clearly, the go-to place is Chief Delphi. It connects all the dots. - JaneYoung [more]
Home
Go Back   Chief Delphi > Technical > Electrical
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 15-02-2010, 22:37
nekng's Avatar
nekng nekng is offline
Former 1836 Captain
AKA: Nate
FRC #1836 (MilkenKnights)
Team Role: Alumni
 
Join Date: Aug 2006
Rookie Year: 2007
Location: Los Angeles
Posts: 43
nekng is on a distinguished road
Another Switch Help Thread

Hi all,

I can't seem to figure this out. From what I understand, if I use a switch to bridge the signal and ground of one of the GPIO channels on the Digital Sidecar, then when the switch is closed I ought to get a reading of 0 and when it is open I ought to get a reading of 1. As far as I'm aware, the DSC has an internal resistor and I do not need an additional one. And also, as far as I'm aware, the following code should work:

DigitalInput* digi10= new DigitalInput(4,10);
if (digi10->Get())
printf("Pin 10: TRUE\n");
else if (!digi10->Get())
printf("Pin 10: FALSE\n");

So why is digi10->Get() always false no matter what the switch position is?

Also, before I tried to get a simple switch to work, I was attempting to use the photoswitch to work (the one provided in the 2006 KOP). Both the receiver and source require 12v which I supply from the power distribution board. The green/white wires are each a signal, one is NC and one NO. I tried plugging one of these into a GPIO port but that didn't work...The photoswitch itself is working though--it has a red light on the receiver that turns on when the beam is unbroken.

Any suggestions?
__________________
  #2   Spotlight this post!  
Unread 16-02-2010, 01:55
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Another Switch Help Thread

First, try:

DigitalInput* digi10= new DigitalInput(4,10);
if (digi10->Get()) printf("Pin 10: TRUE\n");
else printf("Pin 10: FALSE\n");

If it is not true, its false...

We typically test for the closure of a switch,
the digital input going to zero, so to speak.
Which way you go here can depend on which
way you want a wiring failure to influence your
control logic.

Next, for your switch case, make sure that you are closing
a connection between the ground (-) and the signal input,
leaving the 5 volt power line not connected to anything.

For the banner sensor, make sure that it is an NPN unit
and wire the 12 volt line directly to a breaker, the
ground line to the ground (-) connection on the digital
input and the line that closes appropriately to the signal
line. Make sure that you refer to correct documentation
for the sensor, as the wire colors are non-intuitive. On the
sensor we are using, the brown is 12V, the blue is ground
or (-) and the white and black lines are the signal lines,
one NC and one NO.

Have fun,
Eugene

Last edited by eugenebrooks : 16-02-2010 at 01:58.
  #3   Spotlight this post!  
Unread 16-02-2010, 10:31
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,813
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Another Switch Help Thread

For most switches, you'll have wiring options for NC and NO - normally closed and normally open. When wired to use the normally closed option, the switch "assumes" that when it is NOT pressed, it should make a connection, and when it is pressed, it shouldn't - in other words, it's false when not pressed, true when pressed. The normally open configuration is opposite.

Now, lets make sure things are wired up properly. Do you have a multimeter available? Set it to measure resistance, unplug the switch from the side car and put one probe on the ground wire from the switch, and the other on the signal wire - what do you see? Now have a friend depress the switch - what do you see? You should see infinite resistance (often represented by a "1" on the far left of the readout) in one case, and 0 (or close to it) in the other.

You can do a similar test with the photosensor to ensure it's working. However, it will need to be powered, and you'll want to check voltage between ground and the two signal wires - you should see it go between 0V and 5V.

Once you've eliminated the switch and the wires... Then i would suspect something with code, but as I'm pretty unfamiliar with the libraries for the cRio (I switched from being a programming mentor to an electrical mentor right before FIRST switched from IFI), I'm probably not the best person to help there.
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
Yet another Camera thread... Pancake C/C++ 2 26-01-2009 11:42
Yet another bumper thread Vikesrock Technical Discussion 26 19-01-2009 17:04
Need Help Wiring Micro Switch/Limiting Switch Windward Electrical 2 07-02-2006 18:26
Another VEX related thread... Joe Johnson FIRST Tech Challenge 0 22-03-2005 11:52
Yet another reason to make the Switch... Joe Matt Chit-Chat 56 15-01-2005 18:00


All times are GMT -5. The time now is 07:50.

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