! XPRESS programs consist of 3 sections: configuration, continuous, & ! sequential. ! ! NJC Tue Jul 28 19:43:24 EDT 1998 ! Used to experiment. ! !*[ Config ]****************************************************************** CONFIG SC = SpectraSense DEFINE LED = Output(160) ! SS inputs & outputs start at 160 DEFINE BLTimer = Timer(0) DEFINE Daytime = 1 DEFINE MODE = Variable(0) DEFINE Y = Variable(1) DEFINE M = Variable(2) DEFINE D = Variable(3) ! A ! B ! C ! D ! E ! F ! G Dining room DR ! H Kitchen KI ! I Bathroom (Up) UB ! J Bedroom #1 B1 ! K Bedroom #2 B2 ! L Master Bedroom BM ! M Garage GA ! N Back yard BY ! O Front yard FY ! P Broadcast FF ! Which X10 House codes to monitor Display Modules = A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P ! Now for the SS-Voice stuff DEFINE LightLevel = ADC(128) DEFINE RingTimer = Timer(3) DEFINE AlarmOn = Variable(17) DEFINE Password = Variable(30) DEFINE PhoneLevel = Variable(31) DEFINE Selection = Variable(32) DEFINE Light = Variable(33) DEFINE DoorSensor = Input(164) DEFINE InsideLight = Module(N6) !*[ Continuous ]************************************************************** BEGIN IF Reset then ! Don't put any variable before this, they will be cleared ClearVariables; ClearTimers !ClearLog OnHook PhoneLevel = 0 Say "Successful system reset" BlTimer = ON Refresh = 0 Y = Year M = Month D = Day Mode = 1 Log(0) = 1 !Put the entry in European format for easy sorting by time Console = "%P0/%P0/%P0 %B : Reset occured", Y, M, D !Network = "DIO0 RESET" END IF BlTimer >= 2 THEN IFA LED = OFF THEN LED = ON ELSE LED = OFF ! THis is a pain, the PL-LINK keeps sending junk all the time! Refresh = 0 END BlTimer = ON END IF ACPower = ON THEN Console = "%P0/%P0/%P0 %B : AC Power restored", Y, M, D ELSE Console = "%P0/%P0/%P0 %B : AC Power failed", Y, M, D END !IF ACFailed = FALSE AND ACPower = ON THEN ! Console = "%P0/%P0/%P0 %B : AC Power failed occured", Y, M, D !END !*[ Sequential ]************************************************************** SEQUENTIAL !***************************************************************************** IF RingTimer= OFF AND Rings = 1 THEN RingTimer = On END IF RingTimer= ON AND Rings > 1 THEN RingTimer = OFF END IF RingTimer > 60 THEN RingTimer = OFF END IF RingTimer > 8 and Rings = 1 THEN RingTimer = OFF OffHook Say "~@ ~60P ~3F" Say "~2 Hello. ~5S" Say "Welcome to our house." Say "Please enter your password." Password = DTMFnumber(150) IFA Password = 1234 THEN Say "|Thank you." PhoneLevel = 1 ELSE SayW "That is wrong. Goodbye." PhoneLevel = 0 OnHook END END IFA PhoneLevel = 1 THEN Say "Please make a selection." Say "Press zero for a list of choices." Selection = DTMFdigit(250) IFA Selection < 0 THEN SayW "Timed out. Goodbye." PhoneLevel = 0 END IFA Selection = 0 THEN Say "|Press 1 for light level .." Say "Press 2 for alarm status.." Say "Press 9 to finish.." END IFA Selection = 9 THEN SayW "|Have a nice day. Goodbye." Phonelevel = 0 OnHook END IFA Selection = 1 THEN Light = (LightLevel * 100)/26 Say "|~D DH IY ~T outside light" Say "is at %P1%%.", Light END IFA Selection = 2 THEN IFA AlarmOn = TRUE THEN Say "|~D DH IY ~T alarm is on." ELSE Say "|~D DH IY ~T alarm is off." END END IFA (Selection > 2 AND Selection < 9) OR Selection > 9 THEN Say "|Invalid selection. Please try again." END END IF PhoneLevel = 0 THEN OnHook END !*[ End ]*********************************************************************