• Thr 2019.12.19

    'is there a way to loop on a init phase 'til it works? (a loop on the "try catch")?'

    Hello @Mrbbp, would you be so kind as to upload the output for the above snippet? Although L1,L2,L3 and L13 are not adding any value here, (as I2C is not setup by L2, an immediate error should be thrown - maybe the intention of the outer try/catch?) the output should fill multiple "try again" messages with two bytes placed on the I2C bus each 100msec, unless/until an error is detected, in which case "does not init < error msg detail here >" should display.

    Effectively, you have the looping mechanism you are after. 100msec may be too fast for the left hand console panel of the WebIDE to keep up though.

    Any additional detail in the WebIDE console output?
    WebIDE >> Settings >> Console

  • @Robin
    i give you more off my onInit()

    const onInit = function() {
      pinMode(B6, 'opendrain');
      pinMode(B7, 'opendrain');
      /* rajouter les init de connexion pour le display */
      // initialisation I2C
      I2C1.setup({scl: B6,sda: B7});
      // rouge
      try {
        I2C1.writeTo(0x70, 0x21); // turn on oscillator
      } catch(e) {
        I2C1.setup({scl: B6,sda: B7});
        setTimeout(function() {
          console.log("try again");
          try {
            I2C1.writeTo(0x70, 0x21); // turn on oscillator
          } catch(e) {
            console.log("does not init",e);
        }, 500);
        console.log("init I2C");
        // init suite I2C
        I2C1.writeTo(0x70, 0x81); // display on
        I2C1.writeTo(0x70, 0xE0 | 0); // luminosité 0-15
        setTimeout(envoieMatrice, 2000);

    and the output.
    It does not loop
    it try once as in the code
    if i well understand, it fail on the first communication

    init I2C
    Uncaught InternalError: Timeout on I2C Write BUSY
     at line 1 col 541
    ... I2C'),I2C1.writeTo(112,129),I2C1.writeTo­(112,224),digitalPu...
    in function called from system
    try again
    does not init InternalError: InternalError: Timeout on I2C Write BUSY

Avatar for Mrbbp @Mrbbp started