• I am delaying the code. Here is what I have. There is also a display hooked up.

    var i2c = new I2C();
    I2C1.setup({scl: D20, sda: D22});
    var mpl = require("MPL3115A2").connect(i2c);
    var lcd = require("HD44780").connectI2C(I2C1, 0x3F);
    lcd.setCursor(0, 0);
    setTimeout(() => {
      setInterval(() => {
        mpl.getPressure(function(x) {
          console.log("Pressure "+x+" pa");
          mpl.getAltitude(function(x) {
            console.log("Altitude "+x+" m");
              mpl.getTemperature(function(x) {
              console.log("Temperature "+x+" C");
      }, 5000);
    }, 1000);
  • Fri 2019.12.27

    Wrap L10 thru L22 in a function labeled onInit() as @allObjects points out, calling that with his line of code as the last instruction in the code file.

    Which Espruino device is being used, and is that module being Vcc driven from the Espruino itself?

    Which vendor was the MPL3115A2 acquired from? Some have the onboard regulator to drop the Arduino 5v down to the 3v3 required.

    Turn on time for the MPL3115A2 is a full second. There still may need to be a longer duration with that snippet.


Avatar for calebbrewer @calebbrewer started