• First thing I would try is:

    var ow = new OneWire(B13);
    var temp = require("DS18B20").connect(ow);
        
    function onInit() {
        I2C1.setup({scl:B6, sda:B7});
        lcd = require("HD44780").connectI2C(I2C1);
            
        setInterval(showData, 5000);
    }
    function showData() {
     lcd.clear();
     lcd.setCursor(0,0);
     lcd.print("Current temperature:");
      
     // Get the temperature
     var t = temp.getTemp();
      
     // Round it to the nearest 0.1
     t = Math.round(t*10)/10;
      
     lcd.setCursor(0,1);
     lcd.print("Temp = " + t + " C");
    }
    onInit();
    

    That way, we're not trying to talk to the display until after we've set up I2C.

About

Avatar for DrAzzy @DrAzzy started