Skip to content

Instantly share code, notes, and snippets.

@ElectricImpSampleCode
Last active May 20, 2021 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElectricImpSampleCode/a9825d7ff02bbfaa84e62360f05ab4cb to your computer and use it in GitHub Desktop.
Save ElectricImpSampleCode/a9825d7ff02bbfaa84e62360f05ab4cb to your computer and use it in GitHub Desktop.
Electric Imp imp API example code for imp.scanwifinetworks()
// Scan for local WLANs using imp.scanwifinetworks() asynchronously
try {
imp.scanwifinetworks(function(networks) {
if (networks.len() > 0) {
foreach (index, network in networks) {
server.log(format("%d. %s on channel %d", (index + 1), (network.ssid.len() > 0 ? network.ssid : "<Hidden>"), network.channel));
}
} else {
server.log("No nearby WiFi networks found");
}
});
} catch (err) {
server.error("Could not scan for networks (Error: " + err + ")");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment