View Full Version : Digital In Question
Tom Bottiglieri
02-03-2004, 14:43
If i was going to connect the digitial inputs on the RC to a rotary switch, would i connect the common to voltage or ground on each so that the legs of the switch can go out to the opposite of the before stated so it will complete the circuit. I never really looked at this untill today, and just figured i would do it like last year, but then i remembered last year had the db-15 connections with the ground in the top right corner. BUt this year with PWM type Dig I/O's each one has its own ground, so i was confused what to wire where.
Mark McLeod
02-03-2004, 14:50
If i was going to connect the digitial inputs on the RC to a rotary switch, would i connect the common to voltage or ground on each so that the legs of the switch can go out to the opposite of the before stated so it will complete the circuit. I never really looked at this untill today, and just figured i would do it like last year, but then i remembered last year had the db-15 connections with the ground in the top right corner. BUt this year with PWM type Dig I/O's each one has its own ground, so i was confused what to wire where.
Connect one side of each switch to signal and the other to ground. You really only require one ground connection and several signal connections.
Rickertsen2
02-03-2004, 16:48
I'm assuming the rotary switch you are usign has a single common, and then a bunch of other pins. Pick a groung any ground on the RC and tie each of the other pins to a sig pin. Internaly, all of the gnd pins are connected to each other inside the RC.
jacob_dilles
02-03-2004, 16:53
Internaly, all of the gnd pins are connected to each other inside the RC.
yep, all the grounds are solderd together inside the box. TECHNICLY you should run a ground wire from each that u use so that your not sinking more curent thurgh the ground then your drawing thrugh the postitives :D
lol BUT yes one wire will work fine and i doubt its even in the rules... becasue it doesnt realy matter
Tom Bottiglieri
02-03-2004, 16:54
ok i was just trying to figure out which pin the RC looks at when trying to see highs and lows.
jacob_dilles
02-03-2004, 17:09
when you set a pin to be an "input" in the initilzation code, it automaticly sets an internal pull up resistor. when the switch/rotor/encoder/aliean space ship is "off" as in OPEN the I/O reads a "1" on say "rc_dig_io01" or whatever the variable is. you then proceed to wire the switch to the pin and to ground. that way, when it is in the "on" i.e. "CLOSED" postion, the circut is shorted thrugh ground ( but its thrugh a 100 million billion ohm resistor so its not a problem ) and when you read it it calls it a "0"
so when your rotory switch, pic a ground pin, and solder that to the common. then for each "leg", solder it to inputs 1, 2, 3 etc ( actualy, id start at 7 if you dont have any, its an inturpt thing for future expandibity) so 7, 8, 9 etc. then to code it, you can either have a million
if a=0 and b=1 and c=1 and d=1 {do this}
if a=1 and b=0 and c=0 and d=1 {do this}
if a=0 and b=1 and c=0 and d=1 {do this}
if a=1 and b=0 and c=0 and d=1 {do this}
or you can have a switch statement. or NESTED switch statements.
or even better, you could have a lookup table! lol have fun with the code tho...
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.