diff options
| author | Dave Wilson <[email protected]> | 2015-03-17 19:50:07 -0700 |
|---|---|---|
| committer | Dave Wilson <[email protected]> | 2015-03-17 19:50:07 -0700 |
| commit | 97cf5197cf5b882b2c689d8dc2b555f2edf8f418 (patch) | |
| tree | 46f3701832d70b420eb0fc0eb93261f9da45db3f /wpd/WpdBasicHardwareDriver/firmware/flex_force_wpd_enabled.bs2 | |
| parent | ef1905bf1e8825bb31120dfb27e0daf3154d859a (diff) | |
Initial publish
Diffstat (limited to 'wpd/WpdBasicHardwareDriver/firmware/flex_force_wpd_enabled.bs2')
| -rw-r--r-- | wpd/WpdBasicHardwareDriver/firmware/flex_force_wpd_enabled.bs2 | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/wpd/WpdBasicHardwareDriver/firmware/flex_force_wpd_enabled.bs2 b/wpd/WpdBasicHardwareDriver/firmware/flex_force_wpd_enabled.bs2 new file mode 100644 index 00000000..9b9e5b2c --- /dev/null +++ b/wpd/WpdBasicHardwareDriver/firmware/flex_force_wpd_enabled.bs2 @@ -0,0 +1,60 @@ +' Flex_force_wpd_enabled.bs2 +' +' Displays R/C Discharge Time in BASIC Stamp DEBUG Window +' +' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +' ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +' THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +' PARTICULAR PURPOSE. +' +' Copyright (c) Microsoft Corporation. All rights reserved +' +' {$STAMP BS2} +' {$PBASIC 2.5} +' ========================================================================= + +' -----[ Declarations ]---------------------------------------------------- + +rawForce VAR Word ' Stores raw output +sensorPin CON 15 ' Flexiforce sensor circuit + +' -----[ Main Routine ]---------------------------------------------------- + +SensorID VAR Byte 'Sensor identifier = 5 for PIR +ElementSize VAR Byte 'Size (in bytes) of each element +ElementCount VAR Byte 'Count of elements in packet +Padding VAR Byte 'Padding for the 8-byte element + +SensorID = 3 +ElementSize = 1 +ElementCount = 5 '4-bytes for pressure data; 5 for interval + +NewInterval VAR Word 'New interval requested by user +Interval VAR Word 'Interval value utlized by firmware + +Interval = 200 +NewInterval = 200 + +LFD CON $10 'Linefeed character + +Main: + + GOSUB PollSensor 'Was motion detected? + GOSUB RetrieveInterval 'Retrieve units data + +Timeout: + SEROUT 16, 16468, [DEC1 SensorID, DEC1 ElementSize, DEC1 ElementCount, DEC5 rawForce, DEC5 Interval, LFD] + GOTO Main + +PollSensor: + HIGH sensorPin ' Discharge the capacitor + PAUSE 2 + RCTIME sensorPin,1,rawForce ' Measure RC charge time + RETURN + +RetrieveInterval: + SERIN 16, 16468, Interval, Timeout, [DEC NewInterval] 'Retrieve interval + IF NewInterval >= 10 AND NewInterval <= 60000 THEN + Interval = NewInterval + ENDIF + RETURN |
