You are reading a single comment by @ChristianW and its replies. Click here to read the full conversation.
  • Beginner with espruino and having some trouble with onInit on my Pico:

    function onInit() {
        I2C1.setup({scl:B6, sda:B7});
        var lcd = require("HD44780").connectI2C(I2C1);
        lcd.clear();
        lcd.print( "Hello World!" );
    }
    

    Upload and save() works as expected:

    >reset();
    =undefined
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v88 Copyright 2016 G.Williams
    >echo(0);
    =undefined
    >save()
    =undefined
    Erasing Flash.....
    Writing.......
    Compressed 81600 bytes to 4445
    Checking...
    Done!
    Running onInit()...
    

    But when I un- and re-plug USB it's not working - the LCD is staying blank:

    Disconnected
    Connected
    >Loading 4445 bytes from flash...
    Running onInit()...
    =undefined
    Uncaught InternalError: Timeout on I2C Write Transmit Mode 2
     at line 2 col 13
    g|4,g|4,g,g])
                ^
    in function "a" called from line 1 col 7
    a(51,1);a(50,1);a(40,1);a(12,1);a(6,1);a­(1,1);return{write:a...
          ^
    in function "h" called from line 2 col 15
    g|4,g|4,g,g])})
                  ^
    in function "connectI2C" called from line 5 col 49
        var lcd = require("HD44780").connectI2C(I2C1);
                                                    ^
    in function called from system
    =undefined
    Execution Interrupted during event processing.
    

    Just manually executing load() again and voila - the LCD shows "Hello World!"

    >load()
    =undefined
    Loading 4445 bytes from flash...
    Running onInit()...
    

    What's going wrong?

About

Avatar for ChristianW @ChristianW started