user117414
Member since Aug 2020 • Last active Sep 2020Most recent activity
-
- 3 comments
- 2,116 views
-
-
hey mr @davidhay. I am trying your code out and I have replaced the host and wifi info with my own, but for some odd reason i am getting a code-6 message not found
-
-
- 5 comments
- 2,568 views
-
I want it to periodically send data to my server... I feel so lost... Okay, so I am running an express server on my computer localhost:3000... I cant figure out how to fetch the data off the esp8266 or like you said, have the esp8266 send the data to my server... I know it is probably so simple to do but I cant put 2 and 2 together for some reason.. I was using a third party library Axios to try to make a call to the esp but can't get that to work. .. Am I on the right path at least? Thanks
-
- 6 comments
- 2,897 views
-
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
-
Aww okay, yes so i would want it to periodically send data to my server... I feel so lost... Okay, so I am running an express server on my computer localhost:3000... I cant figure out how to fetch the data off the esp8266 or like you said, have the esp8266 send the data to my server... I know it is probably so simple to do but I cant put 2 and 2 together for some reason.. I was using a third party library Axios to try to make a call to the esp but can't get that to work. .. Am I on the right path at least? Thanks
Thanks @AkosLukacs