POT Example

BS1 icon {PBASIC 1.0}

Syntax: POT

 

 

 

' POT.BS1
' This program demonstrates the use of the POT command.  Connect one side
' of a 10K potiometer to P0.  To the other side of the potentiomenter
' connect a 0.1 uF capacitor, and then connect the second side of the
' capacitor to Vss (ground).  Before running demo program, use the
' Run | POT Scaling dialog to determine the best Scale factor.

' {$STAMP BS1}
' {$PBASIC 1.0}

SYMBOL  PotPin          = 0             ' 10K pot connected to P0
SYMBOL  Scale           = 110           ' scale value for test circuit

SYMBOL  level           = B2            ' storage of pot "level"

Main:
  POT PotPin, Scale, level              ' read pot level
  DEBUG CLS, "Level = ", #level         ' display
  PAUSE 50                              ' short delay
  GOTO Main                             ' repeat forever
  END

Go to Welcome page

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/8/2012