• Well, this could potentially be an issue I've fixed in the next version (to do with the internal clock getting very confused after a while). I'll do another release in an hour or so and will see if it helps.

    The reset doesn't work because the LCD needs setting up when Espruino restarts, and that isn't done in the example. I'll update the website's example, but for now try:

    SPI1.setup({ baud: 1000000, sck:B3, mosi:B5 });
    var ow = new OneWire(B13);
    
    var g, temp;
    
    function onInit() {
      clearInterval();
    
      temp = require("DS18B20").connect(ow);
      g = require("PCD8544").connect(SPI1,B6,B7,B8­, function() {
        setInterval(onTimer, 500);
      });
    }
    
    function onTimer() {
      // Get the temperature
      var t = temp.getTemp();
      // Round it to the nearest 0.1
      t = Math.round(t*10)/10;
      // Now draw!
      g.clear();
      g.setFontBitmap(); // simple 8x8 font
      g.drawString("Temp",0,0);
      g.drawLine(0,10,84,10);
      g.setFontVector(25); // large font
      g.drawString(t, 0, 15);
      g.flip(); // copy this to the screen
    };
    
    onInit();
    

    Note the use of onInit - which is called automatically.

About

Avatar for Gordon @Gordon started