background image

Copyright © Parallax Inc.   

 

Page 2 of 4 

Basic Wiring 

 

 

Power requirements: 3.3 to 5 VDC (typical); set supply voltage for compatibility with the input of 

your microcontroller 

 

Communication: Single bit HIGH/LOW output for each position 

 

Dimensions: 0.70 x 0.95 x 0.78 in (17.8 x 24.1 x 19.8 mm) 

 

Program KickStarts 

The example programs display the current state of the switch in a terminal/debug window. The 
switch function — such as Up or Left — is shown. The program is set to repeat indefinitely. 

BASIC Stamp HomeWork Board 

 

' {$STAMP BS2} 
' {$PBASIC 2.5} 
 
DO 
  IF (IN0 = 0) THEN DEBUG "Left", CR 
  IF (IN1 = 0) THEN DEBUG "Down", CR 
  IF (IN2 = 0) THEN DEBUG "Right", CR 
  IF (IN3 = 0) THEN DEBUG "Center", CR 
  IF (IN4 = 0) THEN DEBUG "Up", CR 
  PAUSE 200 
LOOP 

Note:

 When this program is run, the BASIC Stamp Debug Terminal will automatically open. 

Содержание 27801

Страница 1: ...e arranged so that they can be used for navigational control Left Right Up Down and Center depress Each of the five switches contains its own 10 kΩ pull up resistor so you don t need to add these to your circuit Just connect wires from the 5 Position Switch directly to your microcontroller When a switch reads 1 HIGH it s open not activated When a switch reads 0 LOW it s closed activated All switch...

Страница 2: ...ram KickStarts The example programs display the current state of the switch in a terminal debug window The switch function such as Up or Left is shown The program is set to repeat indefinitely BASIC Stamp HomeWork Board STAMP BS2 PBASIC 2 5 DO IF IN0 0 THEN DEBUG Left CR IF IN1 0 THEN DEBUG Down CR IF IN2 0 THEN DEBUG Right CR IF IN3 0 THEN DEBUG Center CR IF IN4 0 THEN DEBUG Up CR PAUSE 200 LOOP ...

Страница 3: ... if ina 3 0 pst Str String Right 13 if ina 4 0 pst Str String Up 13 waitcnt clkfreq 3 cnt Note This program uses the Parallax Serial Terminal object library which is included with the Propeller Tool software download Note To view the results of the demonstration after uploading is complete run the Parallax Serial Terminal from the Run menu or press F12 Momentarily depress the Reset button on the P...

Страница 4: ...ht if digitalRead 5 LOW Serial println Up if digitalRead 6 LOW Serial println Center delay 200 Note To view the results of the demonstration after uploading is complete click the Serial Monitor icon in the Arduino IDE This displays the Serial Monitor window Momentarily depress the Reset button on the Arduino board to restart the sketch For More Information See the 5 Position Switch 27801 full docu...

Отзывы: