flexiforce stampdaq.bs2

来自「Parallax, Inc-StoreFront Product Detail 」· BS2 代码 · 共 28 行

BS2
28
字号
' Flexiforce StampDAQ.bs2
' Example with the Flexiforce sensor and StampDAQ
' {$STAMP BS2}
' {$PBASIC 2.5}

' -----[ Declarations ]----------------------------------------------------

rawForce        VAR     word            ' Stores raw output
sensorPin       CON     15              ' Flexiforce sensor circuit
sPin            CON     16              ' Serial transmit pin
Baud            CON     84              ' 9600, 8-bit, no polarity, true

' -----[ Main Routine ]----------------------------------------------------

Initialize:
  PAUSE 1000
  SEROUT sPin,Baud,[CR]                 'prep StampDAQ buffer
  SEROUT sPin,Baud,[CR,"LABEL,rawForce",CR]     
                                        'Label column with rawForce
  SEROUT sPin,Baud,["CLEARDATA",CR]     'Clear all data 

Display:
  HIGH 15                               'Discharge capacitor
  PAUSE 2
  RCTIME sensorPin,1,rawForce           'Measure R/C charge time
  SEROUT sPin,Baud,["DATA,rawForce,", DEC rawForce,CR] 
                                        'Send data to StampDAQ
GOTO Display

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?