Created
March 21, 2020 21:21
-
-
Save sienki-jenki/6c908938774dbbbb8ec84a7ca03b27d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WIFI_NAME = "Sienki 2.4 GHz"; | |
const WIFI_OPTIONS = { password : "password" }; | |
const wifi = require("Wifi"); | |
const http = require("http"); | |
wifi.connect(WIFI_NAME, WIFI_OPTIONS, (err)=> { | |
console.log("loading wifi"); | |
if (err) { | |
console.log("Connection error: "+err); | |
return; | |
}else{ | |
http.get("http://192.168.0.176:4000/api/test", function(res) { | |
res.on('data', function(data) { | |
console.log(data); | |
}); | |
}); | |
} | |
}); | |
setInterval(function(){ | |
console.log(wifi.getStatus()); | |
},5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment