• I have been running this little program for months just to display temperature ..

    var lcd = require("HD44780").connectI2C(I2C1);
    var ow = new OneWire(B13);
    var temp = require("DS18B20").connect(ow);
    	
    function onInit() {
    	I2C1.setup({scl:B6, sda:B7});
    	
    		
    	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();
    
    

    I updated to 1.69 just now (actually not sure what the previous version was) and see this .. which means little to me :( Can anyone here tell me what might have broken and how to fix ? I've swapped the LCD for another, but the same problem ...

     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v69 Copyright 2014 G.Williams
    >echo(0);
    Uncaught Error: I2C device not responding
     at line 2 col 7
    4,e,e])}
           ^
    in function "a" called from line 1 col 8
    {a(51,1);a(50,1);a(40,1);a(12,1);a(6,1);a(1,1);return{write:...
            ^
    in function "f" called from line 2 col 9
    4,e,e])})}
             ^
    in function "connectI2C" called from line 1 col 45
    var lcd = require("HD44780").connectI2C(I2C1);
                                                 ^
    =undefined
    ERROR: Error processing interval - removing it.
    Execution Interrupted during event processing.
    Uncaught Error: Field or method does not already exist, and can't create it on undefined
     at line 2 col 5
     lcd.clear();
         ^
    in function called from system
    > 
    
  • 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.

  • And of course it just works now :)

    Thanks ever so .. blindingly obvious now that you point it out, but was definitely working in that form, for some reason, on a previous version.

    Thanks a million.

  • Great! Glad it's sorted...

    I think in previous versions Espruino's software reset didn't reset the peripherals (like I2C). That'd mean that the very first upload wouldn't work, but after that I2C would stay set up from the last time...

  • Ah ! Nice to know what was going on, thanks.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

1.69 update broke something for me, I think ... lcd not working (HD44780)

Posted by Avatar for patmolloy @patmolloy

Actions