20x4 display and big_number not working ?

Posted on
  • Display works fine on I2C. Trying this code

    I2C1.setup({scl:B6, sda:B7});
    var lcd = require("HD44780").connectI2C(I2C1);
    
    // var lcd = ... from simple example above ...
    var disp = require("big_number").use(lcd);
    // fill the screen with '12345'
    disp.showNumber(12345);
    // or draw just the digits you want, where you want
    

    but get this ..

     _____                 _ 
    |   __|___ ___ ___ _ _|_|___ ___ 
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v60 Copyright 2014 G.Williams
    >echo(0);
    ERROR: Function not found! Skipping. at line 2 col 1
    showDigit(17,a%10);9<a&&showDigit(14,a/1­0%10);99<a&&showDigit(11,a/100%10);999<a­&&showDigit(8,a/1E3%10);9999<a&&showDigi­t(5,a/1E4%10)}
     ^
    at line 2 col 10
    showDigit(17,a%10);9<a&&showDigit(14,a/1­0%10);99<a&&showDigit(11,a/100%10);999<a­&&showDigit(8,a/1E3%10);9999<a&&showDigi­t(5,a/1E4%10)}
              ^
    in function "showNumber" called from line 1 col 22
    =undefined
    > 
    

    Any ideas ?

  • Thanks - I'll take a look at this...

  • Without testing the code, did you try to set throttle in options communications ?
    I have had same problem with other modules, and that helped.

  • JumJum, am sorry - I don't know what that means, or what to do !

    It looks to me like there is a problem in big_number itself somewhere.

    Pat

  • Fixed - just flash again and it should work.

  • Flash 1.60 ?

  • Oh - sorry. No need to flash - just click 'Send to Espruino' again

  • Works :) Brilliant. Thanks ever so. Absolutely amazed at your responsiveness !

  • How does this actually work without me actually re-flashing ? Does

    require("big_number") actually reference something dynamically on the web when you press "Send to Espruino" ? Damn clever ! What is it actually calling ?

  • It is here : http://www.espruino.com/modules
    Or take the WebIDE, click on settings, select communications and you will see.

  • Yes - certain things (filesystem, graphics, http) are built in to Espruino - but most other things that you use require for are just bits of JavaScript. When you type require and then click Send to Espruino, the Web IDE tries to find the JavaScript module with that name where @JumJum mentioned, and if it finds it then it'll copy it into Espruino first :)

    The Espruino is smart enough to do it itself as well (without the Web IDE) - but you need either to have the modules on an SD card, or to be connected to the internet via something like a CC3000.

  • Thanks, have never looked there before so was blissfully unaware of it !

  • Thanks Gordon. I had not taken the time to understand the mechanism at all. Now clear :) Thanks !

  • or to be connected to the internet via something like a CC3000.

    This is in now? I remember you talking about this as a "sometime in the future" - but I don't see anything in the changelog about it...

  • Thanks, I just checked... Yes - that still needs implementing.

  • Cool.

    Honestly, I'm not sure how valuable of a feature it even is, since people will typically program it with the IDE (and not have to worry about modules), or if running autonomously, they'll have either save()'ed with the modules they need loaded, or put them on the SD card.

    And if it's running on it's own, you probably don't want it picking up any version of the module other than the one you developed with anyway. I could see it being done to save RAM (load a module, use it, kill it, then load the next module, because you can't fit all the modules in RAM, or something like that), but the sd card or eeprom is likely a better fit for that use case)

    (sorry for bringing this off topic)

  • Yeah, it's a good point. Low priority anyway :)

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

20x4 display and big_number not working ?

Posted by Avatar for Pat @Pat

Actions