SLEEP Example

BS1 icon BS2 icon BS2e icon BS2sx icon BS2p icon BS2pe icon BS2px icon

Syntax: SLEEP

 

 

 

Connect an LED and 470 Ω resistor as shown below for the demo program.

NOTE: This is written for the BS2 and will run on any BASIC Stamp module. Modify the $STAMP directive (as required) before downloading to the BS1, BS2e, BS2sx, BS2p, BS2pe, or BS2px.

' SLEEP.BS2
' This program lights an LED and then goes to sleep. Connect an LED to pin
' 0 as shown in the description of SLEEP in the manual and run the program.
' The LED will turn on, then the BASIC Stamp will go to sleep. During sleep,
' the LED will remain on, but will blink at intervals of approximately 2.3
' seconds due to the watchdog timeout and reset.

' {$STAMP BS2}


Setup:
  LOW 0                                 ' turn LED on

Snooze:
  SLEEP 10                              ' sleep for approximately 10 seconds
  GOTO Snooze
  END

Go to Welcome page

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/8/2012