![]() |
DS Digital Input/Output
Recently my team went to a competition and I asked for help with out driver station. We had purchased a few Light Switches from the local hardware store and I had no idea how to wire them properly.
So he helped me wire them properly and connect them to DS 1 and 2 on the Driver Station and now I need to figure out how to code them. My current code looks like this Code:
bool switch1;My next problem is we want to wire in a few LED's to the DS so we know what is going on with the robot Code:
m_ds->SetDigitalOut( 1,true); |
Re: DS Digital Input/Output
I'm not sure about the switch problem, cuz i was experiencing the same thing. However the if m_ds is a pointer refering to digital out on the ds, then that code should work. I didn't have any problems with the LEDS.
|
Re: DS Digital Input/Output
A couple of suggestions:
1.Your printf is set to print an int, not a boolean. I don't think there's a flag for boolean, so you might want to change it to use two different printfs depending on the state of the variable 2.Check your switches with a multimeter and make sure current is actually getting through. 3.Check your digital outputs and see if you're actually turning it on. If you are, chances are that you have reversed the polarity to the LED(LEDs are diodes, so they only work one direction) |
Re: DS Digital Input/Output
My next best guess for C++ would be a "c" character flag? If im not mistaken it would print a t or a f then correct?
|
Re: DS Digital Input/Output
Quote:
|
Re: DS Digital Input/Output
I cant get my hands on the light switches right now but I know they have 3 wire leads. I remember him telling me something about "Getting around having to use a resistor" and Double Pole Double Throw
Thanks for all of the help so far! |
Re: DS Digital Input/Output
printf("%i", true); will print 1
and printf("%i",false); will print0 you dont need a bool printf flag, or a if statement just use the int flag (%i or %d) |
Re: DS Digital Input/Output
It must be in the wiring in the switch then because I have tried that.
|
Re: DS Digital Input/Output
We experinced similar trouble. Wire a 1kOhm resistor between the power and signal wires on the switch. That should solve your problem.
|
Re: DS Digital Input/Output
I have a question on the jumpers also, my code looks like this:
Code:
enum{ |
Re: DS Digital Input/Output
Quote:
|
Re: DS Digital Input/Output
I've been using a really simple program to display my driver station inputs to the driver station LCD panel. C++ sources/project included:
http://www.virtualroadside.com/blog/...-test-program/ |
| All times are GMT -5. The time now is 12:36. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi