• Right, I guess it's unlikely to be Serial1 then. Can you try changing:

    function onInit(){
    var ow = new OneWire(A1);
    var sensor = require("DS18B20").connect(ow);
    sensor.setRes(12); 
    digitalWrite([LED1,LED2,LED3],0b100);
    var lcd = require("HD44780").connectI2C(I2C1);
    I2C1.setup({scl:B8,sda:B9});
    lcd.clear(); 
    setTimeout("digitalWrite([LED1,LED2,LED3­],0b010);", 1000);
    setTimeout("digitalWrite([LED1,LED2,LED3­],0b001);", 2000);
    setTimeout("digitalWrite([LED1,LED2,LED3­],0);", 3000);
    // Delay start-up for diagnostics (above) and for LCD clear
    I2C1.setup({scl:B8, sda:B9});
    var rtc = require("DS3231").connect(I2C1);
    }
    

    to:

    var ow,sensor,lcd,rtc;
    function onInit(){
    ow = new OneWire(A1);
    sensor = require("DS18B20").connect(ow);
    sensor.setRes(12); 
    digitalWrite([LED1,LED2,LED3],0b100);
    lcd = require("HD44780").connectI2C(I2C1);
    I2C1.setup({scl:B8,sda:B9});
    lcd.clear(); 
    setTimeout("digitalWrite([LED1,LED2,LED3­],0b010);", 1000);
    setTimeout("digitalWrite([LED1,LED2,LED3­],0b001);", 2000);
    setTimeout("digitalWrite([LED1,LED2,LED3­],0);", 3000);
    // Delay start-up for diagnostics (above) and for LCD clear
    I2C1.setup({scl:B8, sda:B9});
    rtc = require("DS3231").connect(I2C1);
    }
    

    and removing the code you have below that also sets those sensors up? When you write var in a function, it defines a local variable - so you were defining those variables and then they were being forgotten when the function exited. That shouldn't have caused a memory leak, but it might have caused some problems.

    Can you also try typing trace() right after you load the program (and copy/paste it to a file) and then 'trace()' after it's lost some memory (and save that to a file as well)? We can then just 'diff' the two traces and see if it's actually a bigger than normal string or similar that is causing the leak.

About

Avatar for Gordon @Gordon started