• 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,No­deMCU.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: 'whatdoIputhereifIamrunningalocalserverw­ithexpress',
        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

About

Avatar for user117414 @user117414 started