Thread: Bs2
View Single Post
  #4   Spotlight this post!  
Unread 08-07-2002, 12:27
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Basically, if you want something to be an input (like the pressure switch), start with
Code:
Input X
where X is the number of the pin you want to make be an input. Likewise, use
Code:
Output X
for any pins you want to be outputs (relays, PWMs, etc).

Then, the bit variables inX and outX (pre-defined by the BS2, don't worry about declaring them) will represent the states of these pins. For example:
Code:
Output 2
Input 3
out2=0
if (in3=0) then switchIsOff
out2=1
switchIsOff:
Remember, the normal BS2 does NOT use serin/serout for I/O, everything is pin-addressable only. Also, you won't be able to use the Spike relays that we use for FIRST as they are specific to the Isaac32(or 16) controllers.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php

Last edited by rbayer : 08-07-2002 at 12:58.