Go to Post If only more people could have the same attitude toward FIRST as they do toward their fellow teams! - Jaine Perotti [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 23-01-2014, 21:06
MHSrobotics2853's Avatar
MHSrobotics2853 MHSrobotics2853 is offline
Mililani Robotics
FRC #2853 (Trobobots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Mililani, HI 96789
Posts: 47
MHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really nice
Microswitch only returns 0

We need help with our microswitch.

We've tested it with the multimeter (returns 5V when not pressed 0V pressed). When we press it, it won't return 1, the only value it returns is 0.

It's plugged into the Digital I/O port (we've already swapped out three sidecars so we know that that's not the issue). Our code is as follows:
Code:
#include "WPILib.h"
#include <DigitalInput.h>
#include <DigitalOutput.h>
#include <DigitalSource.h>

class RobotDemo : public SimpleRobot
{
	DigitalInput micro;
	
public:
	RobotDemo(void):
		micro(2,14)
		{	
		}
	void Autonomous()
	{
	}
	void OperatorControl()
	{
		while (IsOperatorControl())
		{	
			DriverStationLCD *groundhogs = DriverStationLCD::GetInstance();
			while (micro.Get() == 0)
			{
				groundhogs -> PrintfLine(DriverStationLCD::kUser_Line2, "I'm not pressed!");
				Wait (0.005);
				groundhogs -> UpdateLCD();
			}
			groundhogs -> PrintfLine(DriverStationLCD::kUser_Line2, "I'm pressed!");
			Wait (0.005);
			groundhogs -> UpdateLCD();
		}
	}
	
	/**
	 * Runs during test mode
	 */
	void Test() {
		
	}
};

START_ROBOT_CLASS(RobotDemo);
We've been ripping out our hair over this for two days already. Any suggestions/answers/holy revelations? Thanks!

Last edited by MHSrobotics2853 : 23-01-2014 at 21:09.
  #2   Spotlight this post!  
Unread 23-01-2014, 21:10
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,599
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Microswitch only returns 0

You're instantiating the switch on digital module 2, which is probably not what you want.
  #3   Spotlight this post!  
Unread 23-01-2014, 21:13
MHSrobotics2853's Avatar
MHSrobotics2853 MHSrobotics2853 is offline
Mililani Robotics
FRC #2853 (Trobobots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Mililani, HI 96789
Posts: 47
MHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really nice
Re: Microswitch only returns 0

We've already tried it as (14) and (1,14). (2,14) was our most recent trial. Still won't work
  #4   Spotlight this post!  
Unread 23-01-2014, 21:26
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 582
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: Microswitch only returns 0

1. How exactly do you have it wired?
2. Try changing the cable that connects the sidecar to the cRIO
3. Does it work on another port?
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
  #5   Spotlight this post!  
Unread 24-01-2014, 00:09
MHSrobotics2853's Avatar
MHSrobotics2853 MHSrobotics2853 is offline
Mililani Robotics
FRC #2853 (Trobobots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Mililani, HI 96789
Posts: 47
MHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really nice
Re: Microswitch only returns 0

1. Digital module to sidecar (occupies second slot on the cRIO), sidecar to switch on the Digital IO row
2. We have already switched but it still hasn't worked
3. No, not on any port (we've literally tried all of them)
  #6   Spotlight this post!  
Unread 24-01-2014, 00:20
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 443
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Microswitch only returns 0

how is your limit switch wired?

The digital sidecar has internal pullup resistors on its input channels. This means that when nothing is connected to the pins it sees 5v.

Your switch should have a ground and a signal wire connected to it (5v isnt' required). Per your stated wiring, when the switch is pressed, the signal wire should be shorted to ground. If this is not the case, then you won't see a logic level state change at the digital side car.
__________________
http://team2168.org
  #7   Spotlight this post!  
Unread 24-01-2014, 00:23
kevin.li.rit's Avatar
kevin.li.rit kevin.li.rit is offline
Imaginary Friend
AKA: Kevin Li
FRC #0596 (SciClones)
Team Role: Student
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Hopkinton, Massachusetts
Posts: 936
kevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond repute
Send a message via Yahoo to kevin.li.rit
Re: Microswitch only returns 0

Quote:
Originally Posted by MHSrobotics2853 View Post
We've tested it with the multimeter (returns 5V when not pressed 0V pressed). When we press it, it won't return 1, the only value it returns is 0.
In this case I would expect it tor return a 0 when pressed. Does it return 1 when not pressed?
__________________
Kevin Li

596 - Sciclones
1405 - Finney Falcons
2262 - Holliston Panthers
  #8   Spotlight this post!  
Unread 24-01-2014, 00:35
MHSrobotics2853's Avatar
MHSrobotics2853 MHSrobotics2853 is offline
Mililani Robotics
FRC #2853 (Trobobots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Mililani, HI 96789
Posts: 47
MHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really nice
Re: Microswitch only returns 0

Quote:
Originally Posted by kevin.li.rit View Post
In this case I would expect it tor return a 0 when pressed. Does it return 1 when not pressed?
It doesn't it only returns zero
  #9   Spotlight this post!  
Unread 24-01-2014, 00:38
kevin.li.rit's Avatar
kevin.li.rit kevin.li.rit is offline
Imaginary Friend
AKA: Kevin Li
FRC #0596 (SciClones)
Team Role: Student
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Hopkinton, Massachusetts
Posts: 936
kevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond repute
Send a message via Yahoo to kevin.li.rit
Re: Microswitch only returns 0

Can you post a wiring diagram of how your switch is wired?
__________________
Kevin Li

596 - Sciclones
1405 - Finney Falcons
2262 - Holliston Panthers
  #10   Spotlight this post!  
Unread 24-01-2014, 01:01
MHSrobotics2853's Avatar
MHSrobotics2853 MHSrobotics2853 is offline
Mililani Robotics
FRC #2853 (Trobobots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Mililani, HI 96789
Posts: 47
MHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really nice
Re: Microswitch only returns 0



Its our test bed; the microswitch is in the lower right connected to the Digital IO slot in the sidecar, which is connected to the second cRIO module slot.

(Ignore bunch of arrows coming out of the sidecar, mocked this up real quick.)
  #11   Spotlight this post!  
Unread 24-01-2014, 01:22
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Microswitch only returns 0

You're only showing one connection for your switch, and its ends aren't labeled with anything specific. People keep asking you how you have it wired, and obviously you aren't understanding the level of detail they're looking for. What pins on the Digital Sidecar connect to what terminals on the switch?
  #12   Spotlight this post!  
Unread 24-01-2014, 01:28
MHSrobotics2853's Avatar
MHSrobotics2853 MHSrobotics2853 is offline
Mililani Robotics
FRC #2853 (Trobobots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Mililani, HI 96789
Posts: 47
MHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really niceMHSrobotics2853 is just really nice
Re: Microswitch only returns 0


We wired the switch like this. It's hooked up to the third row of pins in the digital IO column (ground next to the port number, signal next to the guard)

Please don't be angry with us :/ Nuances in text and the group we have this year is pretty new to the forums.
  #13   Spotlight this post!  
Unread 24-01-2014, 01:52
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Microswitch only returns 0

Do you read a 1 from the switch when it isn't physically plugged in? If so, then your switch might be faulty.

If you still read 0 from a digital input that isn't connected to anything, then there's a software or wiring problem elsewhere and we'll have to do some deeper troubleshooting. Start by describing for us what the big orange Robot Signal Light is doing.
  #14   Spotlight this post!  
Unread 24-01-2014, 02:22
kevin.li.rit's Avatar
kevin.li.rit kevin.li.rit is offline
Imaginary Friend
AKA: Kevin Li
FRC #0596 (SciClones)
Team Role: Student
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Hopkinton, Massachusetts
Posts: 936
kevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond repute
Send a message via Yahoo to kevin.li.rit
Re: Microswitch only returns 0

Is this returning the fatal instance and returning 0?

Is micro.get() passing enough parameters to read the digital I?
__________________
Kevin Li

596 - Sciclones
1405 - Finney Falcons
2262 - Holliston Panthers

Last edited by kevin.li.rit : 24-01-2014 at 02:32. Reason: bleh reading
  #15   Spotlight this post!  
Unread 24-01-2014, 14:42
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 443
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Microswitch only returns 0

The wires going to the switch look ok, is it plugged into the digital sidecar like shown in the attachment?

Click image for larger version

Name:	switch wiring.jpg
Views:	71
Size:	44.5 KB
ID:	15941
__________________
http://team2168.org
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


All times are GMT -5. The time now is 19:24.

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