I haven't tested it, and it can surely be done more elegantly, but this should be a little closer to what you are attempting....I did not check to see if you are initializing the registers correctly.
SYMBOL HORN = GPIO.0 'FAULT HORN
SYMBOL CT = GPIO.2 'CT PIN 5 (TRIPS LOW)
SYMBOL LED = GPIO.5 'LED PIN 2
A VAR WORD
EVENT VAR BYTE
HORN =0
LED =0
EVENT =0
MONTIOR:
IF CT = 0 Then FAULT
GoTo MONTIOR
FAULT:
LED = 1
Pause 5000
LED = 0
CHECK:
For A = 0 TO 60000
Pause 1
IF CT = 0
GOSUB FAULT_AGAIN
ENDIF
Next A
EVENT = 0
GOTO MONITOR
FAULT_AGAIN:
EVENT = EVENT + 1
IF EVENT = 2 THEN THR
SEC:
LED = 1
Pause 5000
LED = 0
RETURN
THR:
HORN = 1
Pause 5000
HORN = 0
EVENT = 0
GoTo MONTIOR
Bookmarks