Monday, February 5, 2007
Proto1_v2 update
Got everything set up and running correctly except for either a code or a PIR issue. Using the code provided on the blog, we got the PIR to trip properly with actual movement at the beginning and the memory wire flexed. Afterwards, it tripped and cleared constantly without any actual movement being read from the PIR.
By adding an END statement at the end of the DO: LOOP UNTIL segment of code, it would trip properly at first but would not trip again.
MAIN:
DO
IF PIR = 1 THEN ' Motion Detected?
counter = counter + 1 ' Update Trip Counter
HIGH 2 ' send power TO flexinol
DEBUG HOME, "TRIPPED...", DEC3 counter
DO
LOOP UNTIL PIR = 0 ' WAIT FOR PIR TO Clear
DEBUG HOME, "CLEARED...", DEC3 counter
LOW 2 ' Turn Off flexinol
END
ENDIF
LOOP
So, either the latest code provided is correct and our PIR is simply being tripped consistently and incorrectly, or the code is looping incorrectly. We've tried a number of variations of the code to no avail.
By adding an END statement at the end of the DO: LOOP UNTIL segment of code, it would trip properly at first but would not trip again.
MAIN:
DO
IF PIR = 1 THEN ' Motion Detected?
counter = counter + 1 ' Update Trip Counter
HIGH 2 ' send power TO flexinol
DEBUG HOME, "TRIPPED...", DEC3 counter
DO
LOOP UNTIL PIR = 0 ' WAIT FOR PIR TO Clear
DEBUG HOME, "CLEARED...", DEC3 counter
LOW 2 ' Turn Off flexinol
END
ENDIF
LOOP
So, either the latest code provided is correct and our PIR is simply being tripped consistently and incorrectly, or the code is looping incorrectly. We've tried a number of variations of the code to no avail.