Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Switch Program (http://www.chiefdelphi.com/forums/showthread.php?t=104012)

DavisC 29-02-2012 13:08

Switch Program
 
Using the Honeywell Switch on the robot. What declaration do I use? And how do I get the state it is in? Do I use the DigitalIOButton to declare it and just use the Get() which returns a bool value?

Thanks in advance!
Davis

mikets 29-02-2012 13:22

Re: Switch Program
 
The DigitalIOButton class is for a button on the DriverStation (e.g. connected to the Cypress module). Are you using that? Or is your switch connected to the robot? I am assuming it's on the robot. If so, are you connected it through some digital input channel? The way to access a switch connected to a digital input channel is something like this (assuming digital input channel 1):
Code:

DigitalInput limitSwitch(1);
...
...
limitSwitch.Get();


DavisC 29-02-2012 13:23

Re: Switch Program
 
Yes the switch is on the robot connected to DIO port 1 on the DSC.

synthmusic 13-03-2012 00:42

Re: Switch Program
 
Quote:

Originally Posted by DavisC (Post 1136779)
Yes the switch is on the robot connected to DIO port 1 on the DSC.

Not sure if this is what you are looking for, but as an example we have a switch used as a travel limit to stop a motor. It's used as follows:



DigitalInput *bBallElevatorTopLimit;
...
bBallElevatorTopLimit = new DigitalInput(2,2);
...
// if top limit clicked
if (!bBallElevatorTopLimit->Get())
...

the switch reports 1 when it is open and 0 when closed because we wired the switch signal to ground on the DSC.

Hopefully that helps!


All times are GMT -5. The time now is 17:34.

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