const wifi = require("Wifi"); const ssid = ""; const password = ""; wifi.connect(ssid, {password:password}, function(e) { if (e) { console.log('error during connect:',e); wifi.disconnect(); } else { console.log('connected to',ssid); require("Wifi").getIP((err, ipinfo) => {console.log(ipinfo)}); wifi.stopAP(); //wifi.save(); } }); const sensor = require("HC-SR04").connect(NodeMCU.D1,NodeMCU.D2,function(dist) { const inches = dist * 0.393701; n = inches.toFixed(2); console.log(n); setInterval(function() { sensor.trigger(); // send pulse }, 10000); function postMe() { content = "Hello"; var options = { host: 'whatdoIputhereifIamrunningalocalserverwithexpress', port: '80', path:'/', method:'POST', headers: { "Content-Type":"application/json", "Content-Length":content.length } }; require("http").request(options, function(res) { // ... }).end(content); }
This is pretty much as far As I've gotten with my code.. I tried to do a test post with no luck so far
@user117414 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.
This is pretty much as far As I've gotten with my code.. I tried to do a test post with no luck so far