Refrigerator temperature sensor with five zones

Modified on 2016/12/23 23:37 by Administrator — Categorized as: Electronics, Environment, _LIB Original MMBasic

This module is part of the original MMBasic library. It is reproduced here with kind permission of Hugh Buckle and Geoff Graham. Be aware it may reference functionality which has changed or is deprecated in the latest versions of MMBasic.

Note: Any required file(s) are available in the attachments tab (top right).

Fridge right temperature? Kids leaving the door open? Midnight snackers?

FRIDGE.BAS
100 FOR i = 1 TO 5 : SETPIN i, 1 : NEXT i
110 SETPIN 10, 2
120 OPEN "FRIDGE.XLS" FOR OUTPUT AS #1
130 PRINT #1, "DATE", "TIME", "T1", "T2", "T3", "T4", "T5", "DOOR"
140 CLOSE #1
150 DO
160   OPEN "FRIDGE.XLS" FOR APPEND AS #1
170   PRINT #1, DATE$, TIME$,;
180   FOR i = 1 TO 5
190     t = (PIN(i) / 3.3 * 3.29 - 2.73) * 100
200     PRINT #1, FORMAT$(t, "%4.1f"),;
210   NEXT i
220   IF PIN(10) THEN PRINT #1, "CLOSED" ELSE PRINT #1, "OPEN"
230   CLOSE #1
240   PAUSE 2000
250 LOOP