#!/usr/sbin/blassic '/home/graham/i2c/solar/solar-set_tank-read_pump_heater_lightlevel.bas ' use solar-set_tank-read_pump_heater_lightlevel.bas ON 'or 'solar-set_tank-read_pump_heater_lightlevel.bas OFF 'to control the relay (ON send panel water to feeder tank) IF PROGRAMARG$(1) = "ON" THEN byte_string$ = "5" 'send 255 IF PROGRAMARG$(1) = "OFF" THEN byte_string$ = "4" 'send 254 'control the relay on to feed roof hot water to the feeder tank - also detect inputs SHELL "/home/graham/i2c/PCF8574_addr_byteout--read_to_ramdisk_slug 32 25"+byte_string$ OPEN "/var/www/ramdisk/PCF8574_port_byte.dat" FOR INPUT AS #1 : INPUT #1,PCF8574_port_byte$ : CLOSE #1 'get the 8 bits that show the PCF8574 port line values BV$ = BIN$ (VAL (PCF8574_port_byte$)) 'port 5 cable is yellow portline5$ = MID$ (BV$, 3, 1) IF VAL (portline5$) = 1 THEN port_5_status$ = "410" IF VAL (portline5$) = 0 THEN port_5_status$ = "420" SHELL "echo -n "+port_5_status$+" >/var/www/ramdisk/port_5_status.txt 'port 6 cable is red portline6$ = MID$ (BV$, 2, 1) IF VAL (portline6$) = 1 THEN port_6_status$ = "430" IF VAL (portline6$) = 0 THEN port_6_status$ = "440" SHELL "echo -n "+port_6_status$+" >/var/www/ramdisk/port_6_status.txt PRINT BV$, " 5 yellow ",port_5_status$," 6 red ",port_6_status$; 'read the solar radiation value SHELL "/home/graham/i2c/PCF8591_address_channel_Vout-ramdisk_slug 73 1 100" OPEN "/var/www/ramdisk/AtoD.dat" FOR INPUT AS #1 INPUT #1,solar$ CLOSE #1 SHELL "echo -n "+solar$+" >/var/www/ramdisk/solar_byte.txt SYSTEM