Auton digital input

kind of confused by some of the things posted. they recommend switching diff auton codes by using if statements to check ditital_input1 (sorry dont remember variable right now) what exactly is digital input 1 hooked up to and/or what is being pressed to set digital input 1 to a value of 1?

also just a thought, can we use switches (as in light switches) and flip them on and off? (dont know too much about how the digital input side wiring goes)
thanks

digital input 1 is digital input 1 on the Robot Controller (I think, I’m not a programmer…). I believe the recommendation was that you could hook up a switch to a digital port on the RC, then during autonomous mode, have the code check the state of the digital switch and run the corresponding autonomous program.

any idea how our electronics girl would wire the switch? i think its you ground one side and connect other to input? btw would it be possible to have a switch on the joystick controller board? (to use as a toggle switch)

The manual is your friend here…page 10 deals with Digital I/O.

Cheers!

1.Wire a switch to contact the outside 2 pins of the digital input XX.
2. Declare the digital pin as INPUT
3. In code read rc_dig_inXX where XX is the pin.

We have a series of 11 being used. :wink:

What method do you use to connect the switch to the ground and signal pins on the rc. The only thing I can think of is hacking up a bunch of pwm cables, but that seems like a waste of cable to me.

I believe somewhere in the FIRST documentation it says to hack a PWM cable for these. I guess it would be possible to take some small gauge wire and run that from the switches to the inputs, but you would have to make sure that the wires coming to the pins dont short in that small space, and im not sure of the legality. I would just recommend sticking with the PWM cables.

So buy the connectors and pins that are used in a pwm cable and use them instead of chopping a $5 cable in half. I bought a batch of them from the Hanson Hobbies RC eBay store. It works out to about 60 cents per connector, plus wire.