home *** CD-ROM | disk | FTP | other *** search
- 120 open 2,2,0,chr$(136)+chr$(0): rem - open rs-232 at 1200 bps
- 130 :
- 140 coffee = 204: lights = 220: rem - assign bsr module 1 and 2 addresses
- 150 :
- 160 c1 = 197: c2 = 199: rem - assign commands for bsr control
- 170 :
- 180 channel = coffee: ctrl = c2: gosub 500: rem - make sure coffee is off
- 190 channel = lights: ctrl = c2: gosub 500:rem - make sure lights are off
- 200 :
- 210 print "[147]morning coffee - program initialization"
- 220 input " enter time now, such as hh,mm ";hours$,minutes$
- 230 ti$ = hours$ + minutes$ + "00"
- 240 :
- 250 input " enter time to turn on coffee ";hours$,minutes$
- 260 tc$ = hours$ + minutes$
- 270 t1 = 60 * val(hours$) + val(minutes$)
- 280 input " enter time to turn on lights ";hours$,minutes$
- 290 tl$ = hours$ + minutes$
- 300 t2 = 60 * val(hours$) + val(minutes$)
- 310 print " have a good night!"
- 320 print " coffee will start at ";left$(tc$,2)+":"+right$(tc$,2)
- 330 print " lights on at ";left$(tl$,2)+":"+right$(tl$,2)
- 340 print " please turn off monitor now..."
- 350 :
- 360 t = 60 * val(left$(ti$,2)) + val(mid$(ti$,3,2))
- 370 if t <> t1 then360
- 380 :
- 390 channel = coffee: ctrl = c1: gosub490: rem - turn on coffee maker
- 400 :
- 410 t = 60 * val(left$(ti$,2)) + val(mid$(ti$,3,2))
- 420 if t <> t2 then410
- 430 :
- 440 channel = coffee: ctrl = c2: gosub490: rem - turn off coffee maker
- 450 channel = lights: ctrl = c1: gosub490: rem - turn on lights
- 460 close 2: print"[147]"
- 470 end: rem - end of program, subroutine to controlle bsr modiles follows
- 480 :
- 490 rem - subroutine to control a bsr module:
- 500 print#2,chr$(channel)
- 510 for paus = 1 to 1000: next paus: rem - short delay
- 520 print#2,chr$(ctrl)
- 530 for paus = 1 to 1000: next paus: rem - short delay
- 540 return
-