I'm pretty sure the problem is that JavaScript executes asynchronously. Obviously I don't know what is in your startAP/enableWifiScan functions, but usually when you execute a command startAP, it returns immediately and calls a callback when the AP is connected.
wifi.startAP(ssid, options, function() {
// this is executed when connected and should start the server
});
// this code is executed before it is connected
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'm pretty sure the problem is that JavaScript executes asynchronously. Obviously I don't know what is in your startAP/enableWifiScan functions, but usually when you execute a command
startAP
, it returns immediately and calls a callback when the AP is connected.For instance for Espruino Wifi you need:
Also, which device are you using the Wifi on?