📄 ex03 - led counter.bs2
字号:
' {$STAMP BS2}
' ==============================================================================
'
' File...... Ex03 - LED Counter.BS2
' Purpose... Binary Counter
' Author.... Parallax
' E-mail.... stamptech@parallaxinc.com
' Started...
' Updated... 01 MAY 2002
'
'
' ==============================================================================
' ------------------------------------------------------------------------------
' Program Description
' ------------------------------------------------------------------------------
' Displays a binary counter on Pins 0 - 7
' ------------------------------------------------------------------------------
' I/O Definitions
' ------------------------------------------------------------------------------
LEDs VAR OutL ' LEDs on Pins 0 - 7
' ------------------------------------------------------------------------------
' Constants
' ------------------------------------------------------------------------------
MinCount CON 0 ' counter start value
MaxCount CON 255 ' counter end value
DelayTime CON 100 ' delay time in milliseconds
' ------------------------------------------------------------------------------
' Variables
' ------------------------------------------------------------------------------
counter VAR Byte
' ------------------------------------------------------------------------------
' Initialization
' ------------------------------------------------------------------------------
Initialize:
DirL = %11111111 ' make pins 0 - 7 outputs
' ------------------------------------------------------------------------------
' Program Code
' ------------------------------------------------------------------------------
Main:
FOR counter = MinCount TO MaxCount ' loop through all count values
LEDs = counter ' show count on LEDs
PAUSE DelayTime ' pause before next number
NEXT
GOTO Main ' do it again
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -