View Single Post
  #4   Spotlight this post!  
Unread 03-03-2004, 15:21
jacob_dilles's Avatar
jacob_dilles jacob_dilles is offline
Registered User
AKA: theshadow
FRC #0620 (WarBots)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Vienna, VA
Posts: 245
jacob_dilles will become famous soon enough
Send a message via AIM to jacob_dilles
Re: wiring and installing a sensor

Quote:
Originally Posted by HuskieRobotics
the kind we need for following the white line
its also a banner brand
the banner sensors that first gives us are tricky little felers. the are IR, and have a built in source which makes it nice and easy. they run on 12v and out put 5 to a normaly open and a normaly closed output. in order to wire it do the following:

brown wire - this is the postitive. connect it to +12V
blue wire - this is the negitive. connect it to ground (on the battery)
black wire - N.O. wire
white wire - N.C. wire

you then can choose between N.O. and N.C. (it REALY doesnt matter). you connect the one you choose to the digital in. for our sake, were gonna say you plug it into digital input 10.

now to code it, in the code first you have to set it as an input. this is done for you in the default code:

Code:
digital_io_10 = 1;
(autonomus or otherwise) you can look at the variable every single loop by saying:
Code:
if(rc_dig_in10 == 1) {
 //do this if its ON
} else {
 //do this if its OFF
}
i hope this helps you
__________________
--------------------------
"You're not a real programmer until all your sentences end with semicolons;"