View Single Post
  #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.