June 4, 2025


    We decided that we really needed a “Cool Enable” button on the thermostat. That pushed our application beyond what could be done with simple conditional tasks! Oh, No, we have to write BASIC code!! Here’s what Edsger Dijkstra (https://history.computer.org/pioneers/dijkstra.html) had to say about it:


It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.


Martin bravely accepted the job!

Here’s the new User Interface. This has to be done 1st because the BASIC code is going to refer to the new Cool Enable button. We actually used the last relay to fake this up. There isn’t any way of doing a neat red/green boolean register on the X-410. Here’s the current BASIC CODE:


'Thermostat Script



DO    'Beginning of main program loop


    'Thawing the evaporator is top priority!

    IF io.evaporatorFrozen = 1

        LET io.hvacCooling = 0

        LET io.hvacBlower = 1

    ELSE

    

        'Cool Enabled is second priority

        IF io.coolEnable > 0 THEN

            

            'Valid temperature reading is third priority

            IF io.hallTemperature <> NAN THEN

                    

                ' Turn HVAC On

                IF io.hallTemperature >= io.coolOnTemp

                    LET io.hvacCooling = 1

                    LET io.hvacBlower = 1

                END IF

                

                ' Turn HVAC off

                IF io.hallTemperature <= io.coolOffTemp

                    LET io.hvacCooling = 0

                END IF

                    

            END IF 'One Wire Sensor reading was valid


            ELSE 'Cooling disabled

                LET io.hvacCooling = 0

            END IF 'Check Cool Enable

            

    END IF 'Evaporator Frozen Check 


LOOP 'End of main program loop


END ' End of main program



Of course Martin didn’t get to this immediately. Below is the latest check in to the git (https://git-scm.com) repository. We use Atlassian’s SourceTree (https://www.atlassian.com/software/sourcetree) to access the repository.


Here’s the latest checkin. Today’s bug fix is shown by the single line deleted in red and the single line added in green. git replaces entire lines. What had to be fixed was io.HallTemperature needed to be io.hallTemperature.

This is yesterday’s checkin, that almost got everything fixed. Line 16 still has the bug in it. Line 17 was debugging by printf. Not only is BASIC awful, embedded BASIC has no visibility, so debugging is really, really hard.