home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 20 / 020.d81 / coffee (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  2KB  |  44 lines

  1. 120 open 2,2,0,chr$(136)+chr$(0): rem - open rs-232 at 1200 bps
  2. 130 :
  3. 140 coffee = 204: lights = 220: rem - assign bsr module 1 and 2 addresses
  4. 150 :
  5. 160 c1 = 197: c2 = 199: rem - assign commands for bsr control
  6. 170 :
  7. 180 channel = coffee: ctrl = c2: gosub 500: rem - make sure coffee is off
  8. 190 channel = lights: ctrl = c2: gosub 500:rem - make sure lights are off
  9. 200 :
  10. 210 print "[147]morning coffee - program initialization"
  11. 220 input " enter time now, such as hh,mm ";hours$,minutes$
  12. 230 ti$ = hours$ + minutes$ + "00"
  13. 240 :
  14. 250 input " enter time to turn on coffee  ";hours$,minutes$
  15. 260 tc$ = hours$ + minutes$
  16. 270 t1 = 60 * val(hours$) + val(minutes$)
  17. 280 input " enter time to turn on lights  ";hours$,minutes$
  18. 290 tl$ = hours$ + minutes$
  19. 300 t2 = 60 * val(hours$) + val(minutes$)
  20. 310 print "          have a good night!"
  21. 320 print "     coffee will start at ";left$(tc$,2)+":"+right$(tc$,2)
  22. 330 print "           lights on at ";left$(tl$,2)+":"+right$(tl$,2)
  23. 340 print "    please turn off monitor now..."
  24. 350 :
  25. 360 t = 60 * val(left$(ti$,2)) + val(mid$(ti$,3,2))
  26. 370 if t <> t1 then360
  27. 380 :
  28. 390 channel = coffee: ctrl = c1: gosub490: rem - turn on coffee maker
  29. 400 :
  30. 410 t = 60 * val(left$(ti$,2)) + val(mid$(ti$,3,2))
  31. 420 if t <> t2 then410
  32. 430 :
  33. 440 channel = coffee: ctrl = c2: gosub490: rem - turn off coffee maker
  34. 450 channel = lights: ctrl = c1: gosub490: rem - turn on lights
  35. 460 close 2: print"[147]"
  36. 470 end: rem - end of program, subroutine to controlle bsr modiles follows
  37. 480 :
  38. 490 rem - subroutine to control a bsr module:
  39. 500 print#2,chr$(channel)
  40. 510 for paus = 1 to 1000: next paus: rem - short delay
  41. 520 print#2,chr$(ctrl)
  42. 530 for paus = 1 to 1000: next paus: rem - short delay
  43. 540 return
  44.