®
BASIC Stamp
2 Program
This program displays the current status (open/closed) of the Reed Switch in the DEBUG window. This
could be used to calibration of the switch/magnet or for testing/debugging purposes.
' =========================================================================
'
'
File...... ReedSwitchTest.bs2
'
Purpose... Display Status Of Reed Switch
'
Author.... Parallax, Inc.
'
E-mail.... support@parallax.com
'
Started... 05-15-2007
'
Updated...
'
'
{$STAMP BS2}
'
{$PBASIC 2.5}
'
' =========================================================================
' -----[ I/O Definitions ]-------------------------------------------------
ReedSwitch
PIN
' -----[ Program Code ]----------------------------------------------------
Main:
DO
IF IN0 = 0 THEN
DEBUG HOME, "CLOSED", CLREOL
ELSE
DEBUG HOME, "OPEN", CLREOL
ENDIF
PAUSE 150
LOOP
© Parallax, Inc. • Reed Switch (#910-27225) • v1.0
0
' Reed Switch Input Pin
' Is Reed Switch Closed?
' CLOSED. Display It
' OPEN. Display It
' Wait A While
' Keep Going
5/07
Page 3 of 3
Need help?
Do you have a question about the Reed Switch and is the answer not in the manual?
Questions and answers