POLLWAIT Example

BS2p icon BS2pe icon BS2px icon

Syntax: POLLWAIT

 

 

 

NOTE: This is written for the BS2p and will also run on the BS2pe and BS2px. Modify the $STAMP directive (as required) before downloading to the BS2pe or BS2px.

' POLLWAIT.BSP
' This program demonstrates the POLLWAIT command.  I/O pin 0 is set to
' watch for a low signal.  Once the Main routine starts running, the
' POLLWAIT command causes the program to halt until the polled event
' happens (I/O pin is low) then it prints a message on the PC screen.
' It will do nothing until I/O pin is low.

' {$STAMP BS2p}
' {$PBASIC 2.5}


Setup:
  POLLIN 0, 0                           ' polled-input, look for 0
  POLLMODE 2                            ' enable polling

Main:
  POLLWAIT 8                            ' Wait for polled event
  DEBUG "I/O pin 0 is LOW!", CR         ' Print message
  GOTO Main

Go to Welcome page

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/8/2012