I think most likely what's happened is device hasn't been recognised - it looks like during the var mcp = require("MCP9808").connect... line there might have been an error reported. If that failed then mcp wouldn't get set - but if you're uploading to RAM then the lines are executed one by one so the next lines would still get executed.
As you'd found with the MAX30102 chip, there could be some reasons why the device isn't discovered using I2C.
Maybe there are no pullup resistors - you could use software I2C and see if it's any better:
var i = new I2C();
i.setup({scl:D25,sda:D26, bitrate: 60000});
var mcp = require("MCP9808").connect(i, 0b000);
But maybe sda/scl are around the wrong way, grounding it wrong, etc
Or maybe the address isn't 0b000 is A0/1/2 aren't GND
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I think most likely what's happened is device hasn't been recognised - it looks like during the
var mcp = require("MCP9808").connect...
line there might have been an error reported. If that failed thenmcp
wouldn't get set - but if you're uploading to RAM then the lines are executed one by one so the next lines would still get executed.As you'd found with the MAX30102 chip, there could be some reasons why the device isn't discovered using I2C.
Maybe there are no pullup resistors - you could use software I2C and see if it's any better:
But maybe sda/scl are around the wrong way, grounding it wrong, etc
Or maybe the address isn't
0b000
is A0/1/2 aren't GND