User Tools

Site Tools


mmbasic:refrigerator_temperature_sensor_with_five_zones

Refrigerator temperature sensor with five zones

fridge.gif

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.

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
mmbasic/refrigerator_temperature_sensor_with_five_zones.txt · Last modified: 2024/01/19 09:30 by 127.0.0.1