• On an arduino there is no pullup resistor to add to circuit.
    i tested with an other backpack, same result.
    some time it works, sometime not.

    i tried with a try catch and resend a I2C.setup() (read it in the forum) in the resend with no more result.

      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);
          }
        }, 100);
      }
    

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

  • 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

About

Avatar for Mrbbp @Mrbbp started