I figured this out. setIP() returns true when it successfully finishes.
Updated onInit code:
function onInit() { console.log("Connecting to Ethernet"); SPI2.setup({ mosi:B15, miso:B14, sck:B13 }); eth = require("WIZnet").connect(SPI2, B10); console.log("Connect?: " + isConnected); isConnected = eth.setIP(); console.log("Connect?: " + isConnected); if (isConnected == true) { mqttConnect(); } //eth.getIP(); eth.getIP(function(f,ip) { console.log("IP: ",ip); mqttConnect(); }); }
@d0773d started
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 figured this out. setIP() returns true when it successfully finishes.
Updated onInit code: