Go to Post Exercise, eat properly, work hard, live hard, play hard, laugh hard, inspire people, solve problems. And leave the world around you a little better place than you found it. - ebarker [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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.
 


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 02:11.

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